Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions HeroAI/combat.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def __init__(self):
self.comfort_animal = GLOBAL_CACHE.Skill.GetID("Comfort_Animal")
self.heal_as_one = GLOBAL_CACHE.Skill.GetID("Heal_as_One")
self.heroic_refrain = GLOBAL_CACHE.Skill.GetID("Heroic_Refrain")
self.arcane_mimicry = GLOBAL_CACHE.Skill.GetID("Arcane_Mimicry")
self.natures_blessing = GLOBAL_CACHE.Skill.GetID("Natures_Blessing")
self.relentless_assault = GLOBAL_CACHE.Skill.GetID("Relentless_Assault")
#junundu
Expand Down Expand Up @@ -343,6 +344,24 @@ def GetAppropiateTarget(self, slot):
if not self.HasEffect(GLOBAL_CACHE.Player.GetAgentID(), self.heroic_refrain):
return GLOBAL_CACHE.Player.GetAgentID()

# Special handling for Arcane Mimicry - target based on party slot
if self.skills[slot].skill_id == self.arcane_mimicry:
# Get the configured target slot from HeroAI options
own_party_number = GLOBAL_CACHE.Party.GetOwnPartyNumber()
if own_party_number != -1:
hero_ai_options = GLOBAL_CACHE.ShMem.GetHeroAIOptions(GLOBAL_CACHE.Agent.GetEmail(GLOBAL_CACHE.Player.GetAgentID()))
if hero_ai_options is not None:
target_slot = hero_ai_options.ArcaneMimicryTargetSlot
# Get the agent ID for the target party slot
players = GLOBAL_CACHE.Party.GetPlayers()
if 0 <= target_slot < len(players):
target_agent_id = GLOBAL_CACHE.Party.Players.GetAgentIDByLoginNumber(players[target_slot].login_number)
# Verify the target is alive and in range
if target_agent_id != 0 and GLOBAL_CACHE.Agent.IsAlive(target_agent_id):
# Make sure we're not targeting ourselves
if target_agent_id != GLOBAL_CACHE.Player.GetAgentID():
return target_agent_id

if target_allegiance == Skilltarget.Enemy:
v_target = self.GetPartyTarget()
if v_target == 0:
Expand Down
2 changes: 1 addition & 1 deletion HeroAI/custom_skill_src/mesmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ def __init__(self, skill_data):
skill.SkillType = SkillType.Spell.value
skill.TargetAllegiance = Skilltarget.OtherAlly.value
skill.Nature = SkillNature.Buff.value
skill.Conditions.TargetingStrict = True
skill.Conditions.TargetingStrict = False # Allow fallback targeting
skill_data[skill.SkillID] = skill

skill = CustomSkill()
Expand Down
2 changes: 2 additions & 0 deletions Py4GWCoreLib/GlobalCache/SharedMemory.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class HeroAIOptionStruct(Structure):
("FlagPosX", c_float),
("FlagPosY", c_float),
("FlagFacingAngle", c_float),
("ArcaneMimicryTargetSlot", c_int), # Party slot to target for Arcane Mimicry (0-based)
]

class AllAccounts(Structure):
Expand Down Expand Up @@ -218,6 +219,7 @@ def ResetHeroAIData(self, index):
option.FlagPosX = 0.0
option.FlagPosY = 0.0
option.FlagFacingAngle = 0.0
option.ArcaneMimicryTargetSlot = 0 # Default to party slot 0 (party leader)


def FindAccount(self, account_email: str) -> int:
Expand Down