mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 12:11:33 -06:00

* Init * remove submodule * Init * Update docs * Fix tests * Update to use apcivvi * Update Readme and codeowners * Minor changes * Remove .value from options (except starting hint) * Minor updates * remove unnecessary property * Cleanup Rules and Region * Fix output file generation * Implement feedback * Remove 'AP' tag and fix issue with format strings and using same quotes * Update worlds/civ_6/__init__.py Co-authored-by: Scipio Wright <scipiowright@gmail.com> * Minor docs changes * minor updates * Small rework of create items * Minor updates * Remove unused variable * Move client to Launcher Components with rest of similar clients * Revert "Move client to Launcher Components with rest of similar clients" This reverts commit f9fd5df9fdf19eaf4f1de54e21e3c33a74f02364. * modify component * Fix generation issues * Fix tests * Minor change * Add improvement and test case * Minor options changes * . * Preliminary Review * Fix failing test due to slot data serialization * Format json * Remove exclude missable boosts * Update options (update goody hut text, make research multiplier a range) * Update docs punctuation and slot data init * Move priority/excluded locations into options * Implement docs PR feedback * PR Feedback for options * PR feedback misc * Update location classification and fix client type * Fix typings * Update research cost multiplier * Remove unnecessary location priority code * Remove extrenous use of items() * WIP PR Feedback * WIP PR Feedback * Add victory event * Add option set for death link effect * PR improvements * Update post fill hint to support items with multiple classifications * remove unnecessary len * Move location exclusion logic * Update test to use set instead of accidental dict * Update docs around progressive eras and boost locations * Update docs for options to be more readable * Fix issue with filler items and prehints * Update filler_data to be static * Update links in docs * Minor updates and PR feedback * Update boosts data * Update era required items * Update existing techs * Update existing techs * move boost data class * Update reward data * Update prereq data * Update new items and progressive districts * Remove unused code * Make filler item name func more efficient * Update death link text * Move Civ6 to the end of readme * Fix bug with hidden locations and location.name * Partial PR Feedback Implementation * Format changes * Minor review feedback * Modify access rules to use list created in generate_early * Modify boost rules to precalculate requirements * Remove option checks from access rules * Fix issue with pre initialized dicts * Add inno setup for civ6 client * Update inno_setup.iss --------- Co-authored-by: Scipio Wright <scipiowright@gmail.com> Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> Co-authored-by: Exempt-Medic <ExemptMedic@Gmail.com> Co-authored-by: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com>
75 lines
3.7 KiB
Python
75 lines
3.7 KiB
Python
import random
|
|
|
|
from typing import TYPE_CHECKING, List
|
|
if TYPE_CHECKING:
|
|
from .Civ6Client import CivVIContext
|
|
|
|
# any is also an option but should not be considered an effect
|
|
DEATH_LINK_EFFECTS = ["Gold", "Faith", "Era Score", "Unit Killed"]
|
|
|
|
|
|
async def handle_receive_deathlink(ctx: 'CivVIContext', message: str):
|
|
"""Resolves the effects of a deathlink received from the multiworld based on the options selected by the player"""
|
|
chosen_effects: List[str] = ctx.slot_data["death_link_effect"]
|
|
effect = random.choice(chosen_effects)
|
|
|
|
percent = ctx.slot_data["death_link_effect_percent"]
|
|
if effect == "Gold":
|
|
ctx.logger.info(f"Decreasing gold by {percent}%")
|
|
await ctx.game_interface.decrease_gold_by_percent(percent, message)
|
|
elif effect == "Faith":
|
|
ctx.logger.info(f"Decreasing faith by {percent}%")
|
|
await ctx.game_interface.decrease_faith_by_percent(percent, message)
|
|
elif effect == "Era Score":
|
|
ctx.logger.info("Decreasing era score by 1")
|
|
await ctx.game_interface.decrease_era_score_by_amount(1, message)
|
|
elif effect == "Unit Killed":
|
|
ctx.logger.info("Destroying a random unit")
|
|
await ctx.game_interface.kill_unit(message)
|
|
|
|
|
|
async def handle_check_deathlink(ctx: 'CivVIContext'):
|
|
"""Checks if the local player should send out a deathlink to the multiworld as well as if we should respond to any pending deathlinks sent to us """
|
|
# check if we received a death link
|
|
if ctx.received_death_link:
|
|
ctx.received_death_link = False
|
|
await handle_receive_deathlink(ctx, ctx.death_link_message)
|
|
|
|
# Check if we should send out a death link
|
|
result = await ctx.game_interface.get_deathlink()
|
|
if ctx.death_link_just_changed:
|
|
ctx.death_link_just_changed = False
|
|
return
|
|
if result != "false":
|
|
messages = [f"lost a unit to a {result}",
|
|
f"offered a sacrifice to the great {result}",
|
|
f"was killed by a {result}",
|
|
f"made a donation to the {result} fund",
|
|
f"made a tactical error",
|
|
f"picked a fight with a {result} and lost",
|
|
f"tried to befriend an enemy {result}",
|
|
f"used a {result} to reduce their military spend",
|
|
f"was defeated by a {result} in combat",
|
|
f"bravely struck a {result} and paid the price",
|
|
f"had a lapse in judgement against a {result}",
|
|
f"learned at the hands of a {result}",
|
|
f"attempted to non peacefully negotiate with a {result}",
|
|
f"was outsmarted by a {result}",
|
|
f"received a lesson from a {result}",
|
|
f"now understands the importance of not fighting a {result}",
|
|
f"let a {result} get the better of them",
|
|
f"allowed a {result} to show them the error of their ways",
|
|
f"heard the tragedy of Darth Plagueis the Wise from a {result}",
|
|
f"refused to join a {result} in their quest for power",
|
|
f"was tired of sitting in BK and decided to fight a {result} instead",
|
|
f"purposely lost to a {result} as a cry for help",
|
|
f"is wanting to remind everyone that they are here to have fun and not to win",
|
|
f"is reconsidering their pursuit of a domination victory",
|
|
f"had their plans toppled by a {result}",
|
|
]
|
|
|
|
if ctx.slot is not None:
|
|
player = ctx.player_names[ctx.slot]
|
|
message = random.choice(messages)
|
|
await ctx.send_death(f"{player} {message}")
|