- Чертоги разума: дух в префабе chertogi под землёй, книга памяти, нож и плакат; кровать префаба - мебель necroPalaceBed (иначе становилась точкой возрождения); охрана выбрасывает и игроков (их нет в EntityAlives). - Хваты пустой руки по R: «отрицание» и «пиф-паф» - поза рук костями поверх аниматора, остальные кости заморожены, ЛКМ - заклинание, прицел краснеет на зомби. - «Отрицание»: зомби в ужасе бежит дальше 40 м и теряет игрока как цель. - «Пиф-паф»: одержимость зомби-гуманоидом - бег, прыжок, удар, дальняя атака, подрыв, крик крикуньи; тело цепенеет, зомби танкуют одержимого; область вокруг тела сжата; полоска здоровья; спавн и прорисовка у одержимого. - Книга с оглавлением (окно necroTome), глава «Некроэнергия». - Прорисовка дверей у змеи и одержимого (CheckLODs от камеры, а не от тела). - Почтовый ящик консоли и команды necrobones/necropose/necroshot для разработки. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
2.9 KiB
C#
61 lines
2.9 KiB
C#
using System.Collections.Generic;
|
||
using HarmonyLib;
|
||
|
||
namespace NecromancerTome
|
||
{
|
||
/// <summary>
|
||
/// Lets a charmed ("Deviator"-hit) zombie actually hurt other zombies.
|
||
///
|
||
/// EntityAlive.DamageEntity has a hardcoded block, independent of anything AI/targeting
|
||
/// related: `if (!isHeatDamage && (entityFlags & attacker.entityFlags & EntityFlags.Zombie) != None)
|
||
/// return -1;` - i.e. any two entities that are BOTH flagged EntityFlags.Zombie (which is
|
||
/// every zombie, always) simply cannot damage each other, full stop, no matter what
|
||
/// CharmPatch.cs did to the attacker's AI targeting. Without this, a charmed zombie would
|
||
/// walk up to another zombie and "attack" it forever with every hit landing as a no-op.
|
||
///
|
||
/// Fix: for the duration of a single DamageEntity call where the attacker currently has
|
||
/// buffNecroDeviatorCharm and the target is also a zombie, temporarily clear
|
||
/// EntityFlags.Zombie on the ATTACKER only (never the target, never persisted) so the AND
|
||
/// check in the original method comes up empty and damage proceeds normally. Restored
|
||
/// immediately afterward, so nothing else about that zombie (kill-counting via its Tags
|
||
/// property, quest tracking, anything else keyed off EntityFlags) is ever affected outside
|
||
/// this one call. A Stack (not a single field) survives re-entrant DamageEntity calls
|
||
/// correctly (e.g. explosions/knockback triggering further damage inside the same callstack).
|
||
///
|
||
/// ОДЕРЖИМОСТЬ (03.10, тест: «здоровье противника не снижалось»): то же самое, если атакующий -
|
||
/// одержимый зомби или цель - одержимый зомби (зомби бьют его, когда он их танкует).
|
||
/// </summary>
|
||
[HarmonyPatch(typeof(EntityAlive), "DamageEntity")]
|
||
public static class Patch_EntityAlive_DamageEntity_CharmedZombieVsZombie
|
||
{
|
||
public static readonly Stack<EntityZombie> ToggledAttackers = new Stack<EntityZombie>();
|
||
|
||
public static void Prefix(EntityAlive __instance, DamageSource _damageSource)
|
||
{
|
||
EntityZombie toggled = null;
|
||
if (__instance is EntityZombie && __instance.world != null)
|
||
{
|
||
EntityAlive attacker = __instance.world.GetEntity(_damageSource.getEntityId()) as EntityAlive;
|
||
if (attacker is EntityZombie attackerZombie
|
||
&& (attackerZombie.Buffs != null && attackerZombie.Buffs.HasBuff(Patch_EntityBuffs_AddBuff_DeviatorCharm.CharmBuffName)
|
||
|| Possession.IsPossessed(attackerZombie) || Possession.IsPossessed(__instance))
|
||
&& (attackerZombie.entityFlags & EntityFlags.Zombie) != EntityFlags.None)
|
||
{
|
||
attackerZombie.entityFlags &= ~EntityFlags.Zombie;
|
||
toggled = attackerZombie;
|
||
}
|
||
}
|
||
ToggledAttackers.Push(toggled);
|
||
}
|
||
|
||
public static void Postfix()
|
||
{
|
||
EntityZombie toggled = ToggledAttackers.Pop();
|
||
if (toggled != null)
|
||
{
|
||
toggled.entityFlags |= EntityFlags.Zombie;
|
||
}
|
||
}
|
||
}
|
||
}
|