[BUG?] ApplyIfSpellTargetKilled + Summon Weirdness
I'm trying to use <ApplyIfSpellTargetKilled> in conjunction with a Summon spell (like Touch of Entropy), except targeting Self, or FriendlyUnit.
After a lot of tweaking and trying different things, I've managed to get it to cast the summon spell when the unit dies... Only the summon always dies instantly! Regardless of the summon's HP (I tried summoning them at level 100: they summon with 600+ HP, then die instantly). Regardless of what creature I try to summon. Has anyone else run into this or have any ideas what could be causing it?
My chain of events is as follows
1. City Enchantment that triggers an autocast battle spell that is an AllFriendlyUnit spell (unfortunately there doesn't seem to be a way to target all units except sovereigns and champions...)
2. Autocast spell gives every friendly unit an enchantment that uses MeleeDefenseAppliesSpell to cast another spell whenever they are hit in melee (unfortunately there doesn't seem to be a way to trigger off of anything except melee attacks...)
3. Spell that gets cast on melee hits does 0 damage to the caster (otherwise it doesn't even seem to check the ApplyIfSpellTargetKilled condition), and casts a summon spell using the ApplyIfSpellTargetKilled tag.
So far I've tried toggling a bunch of different tags, trying different target call-outs for the last summon spell, applying damage or healing... Using the ApplyIfSpellTargetKilled in different modifiers or spells in this chain...
Below is the XML if interested:
- <SpellDef InternalName="NC_UndyingLoyalty">
- <DisplayName>Undying Loyalty</DisplayName>
- <Description>Places a curse on the city's defenders that does not allow them to die. If they are struck down in melee combat, they are reanimated where they once stood. Only when their skeletal remains are destroyed will they know peace.</Description>
- <Image>S_BloodRage_Painting.png</Image>
- <IconFG>S_BloogSigil_Icon.png</IconFG>
- <AutoUnlock>1</AutoUnlock>
- <SpellBookSortCategory>City</SpellBookSortCategory>
- <SpellBookSortSubCategory>CityEnchantment</SpellBookSortSubCategory>
- <SpellType>Strategic</SpellType>
- <SpellClass>Defensive</SpellClass>
- <SpellSubClass>Other</SpellSubClass>
- <SpellTargetType>FriendlyCity</SpellTargetType>
- <Prereq>
- <Type>AbilityBonusOption</Type>
- <Attribute>NecromanticCompendium</Attribute>
- <Target>Player</Target>
- </Prereq>
- <!--
- <Prereq>
- <Type>AbilityBonusOption</Type>
- <Attribute>NC_MasterNecromancy</Attribute>
- </Prereq>
- -->
- <SpellResourceCost>
- <Resource>Mana</Resource>
- <Amount>1</Amount>
- </SpellResourceCost>
- <GameModifier>
- <ModType>City</ModType>
- <Attribute>BattleAutoCastSpell</Attribute>
- <StrVal>NC_Militia_Curse_Autocast</StrVal>
- <Duration>-1</Duration>
- </GameModifier>
- <!--
- <GameModifier>
- <ModType>City</ModType>
- <Attribute>BattleAutoCastSpell</Attribute>
- <StrVal>NC_Archer_Curse_Autocast</StrVal>
- <Duration>-1</Duration>
- </GameModifier>
- -->
- <AIData AIPersonality="AI_General">
- <AIPriority>10</AIPriority>
- </AIData>
- <HitSoundFX>Spell_Beserk_01</HitSoundFX>
- <SpellDefEffect>
- <EffectName>T_Berserk_Particle</EffectName>
- <LocalPosition>0,35,0</LocalPosition>
- <EffectScale>0.7</EffectScale>
- <EffectDelay>0</EffectDelay>
- <SnapToTerrain>1</SnapToTerrain>
- </SpellDefEffect>
- </SpellDef>
- <SpellDef InternalName="NC_Militia_Curse_Autocast">
- <DisplayName>Undying Loyalty</DisplayName>
- <Description>This unit has been cursed, and if slain will rise again and continue fighting.</Description>
- <Image>T_Wither_Painting.png</Image>
- <IconFG>T_Wither_Icon.png</IconFG>
- <CanStack>0</CanStack>
- <SpellBookSortCategory>Unit</SpellBookSortCategory>
- <SpellBookSortSubCategory>Other</SpellBookSortSubCategory>
- <SpellType>Tactical</SpellType>
- <SpellClass>Defensive</SpellClass>
- <SpellSubClass>Other</SpellSubClass>
- <SpellTargetType>AllFriendlyUnits</SpellTargetType>
- <HideInHiergamenon>1</HideInHiergamenon>
- <IsCastable>0</IsCastable>
- <IsResistable>0</IsResistable>
- <GameModifier>
- <ModType>Unit</ModType>
- <Attribute>MeleeDefenseAppliesSpell</Attribute>
- <StrVal>NC_Militia_Curse_Effect</StrVal>
- <Duration>-1</Duration>
- </GameModifier>
- <AIData AIPersonality="AI_General">
- <AIPriority>10</AIPriority>
- </AIData>
- <HitSoundFX>Spell_Wither_01</HitSoundFX>
- <SpellDefEffect>
- <EffectName>T_Wither_Particle</EffectName>
- <LocalPosition>0,30,0</LocalPosition>
- <EffectScale>.75</EffectScale>
- <EffectDelay>0</EffectDelay>
- <SnapToTerrain>1</SnapToTerrain>
- </SpellDefEffect>
- </SpellDef>
- <SpellDef InternalName="NC_Militia_Curse_Effect">
- <DisplayName>Undying Loyalty</DisplayName>
- <Image>T_Wither_Painting.png</Image>
- <IconFG>T_Wither_Icon.png</IconFG>
- <CanStack>0</CanStack>
- <SpellBookSortCategory>Unit</SpellBookSortCategory>
- <SpellBookSortSubCategory>Other</SpellBookSortSubCategory>
- <SpellType>Tactical</SpellType>
- <SpellClass>Defensive</SpellClass>
- <SpellSubClass>Other</SpellSubClass>
- <SpellTargetType>Self</SpellTargetType>
- <HideInHiergamenon>1</HideInHiergamenon>
- <IsCastable>0</IsCastable>
- <IsResistable>0</IsResistable>
- <Range>0</Range>
- <IgnoreInvalidTargetsInRadius>0</IgnoreInvalidTargetsInRadius>
- <GameModifier>
- <ModType>Unit</ModType>
- <Attribute>CurHealth</Attribute>
- <ApplyToCaster>1</ApplyToCaster>
- </GameModifier>
- <GameModifier>
- <ModType>Unit</ModType>
- <Attribute>SummonUnit</Attribute>
- <StrVal>Skeletons</StrVal>
- <ApplyIfSpellTargetKilled>1</ApplyIfSpellTargetKilled>
- <UnitClass>NC_Militia_Skeleton</UnitClass>
- <!--
- <Calculate InternalName="Calc" ValueOwner="CastingUnit">
- <Expression><![CDATA[[Unit_GetLevel]]]></Expression>
- </Calculate>
- <Calculate InternalName="Value">
- <Expression><![CDATA[[Calc]]]></Expression>
- </Calculate>
- -->
- <Value>100</Value>
- <Duration>-1</Duration>
- </GameModifier>
- <AIData AIPersonality="AI_General">
- <AIPriority>10</AIPriority>
- </AIData>
- <HitSoundFX>Spell_Wither_01</HitSoundFX>
- <SpellDefEffect>
- <EffectName>T_Wither_Particle</EffectName>
- <LocalPosition>0,30,0</LocalPosition>
- <EffectScale>.75</EffectScale>
- <EffectDelay>0</EffectDelay>
- <SnapToTerrain>1</SnapToTerrain>
- </SpellDefEffect>
- </SpellDef>