public DieAction(int aId, int aAttackerId, DeathTypeEnum aDeathType) : base(aId, EntityActionEnum.DIE) { this.attackerId = aAttackerId; this.deathType = aDeathType; // TODO: make this not hard coded this.timeToDie = 1f; }
/// <summary> /// /// </summary> public void OnLoseFight(DeathTypeEnum type) { DeathType = type; Life = 1; switch(type) { case DeathTypeEnum.TYPE_HEROIC: Energy = 1; LoseEnergy(); break; case DeathTypeEnum.TYPE_NORMAL: LoseEnergy(); if (Energy > 0) { // get back home if u still have energy babe MapId = SavedMapId; CellId = SavedCellId; } break; } }
public static FightResultEnum GetFightResult(BoardState aBoardState, int aDefenderId, int aAttackerId, DeathTypeEnum aDeathType) { EntityState defender = aBoardState.GetEntityById(aDefenderId); EntityState attacker = aBoardState.GetEntityById(aAttackerId); // if attacker and defender are on different teams, or attacker and defender are on the same neutral team if (attacker.team != defender.team || attacker.team == TeamEnum.NEUTRAL) { switch (aDeathType) { case DeathTypeEnum.BUMP: if (attacker.mobData?.canKillOnTouch == true && attacker.mobData.Value.touchPower > defender.touchDefense) { return(FightResultEnum.DEFENDER_DIES); } if (defender.mobData?.canKillOnTouch == true && defender.mobData.Value.touchPower > attacker.touchDefense) { return(FightResultEnum.ATTACKER_DIES); } break; case DeathTypeEnum.BISECTED: if (attacker.mobData?.canKillOnTouch == true && attacker.mobData.Value.touchPower > defender.touchDefense) { return(FightResultEnum.DEFENDER_DIES); } break; case DeathTypeEnum.FIRE: if (attacker.mobData?.canKillOnTouch == true && attacker.mobData.Value.touchPower > defender.touchDefense) { return(FightResultEnum.DEFENDER_DIES); } break; case DeathTypeEnum.SQUISHED: if (attacker.mobData?.canKillOnFall == true && attacker.mobData.Value.fallPower > defender.fallDefense) { return(FightResultEnum.DEFENDER_DIES); } if (defender.mobData?.canKillOnFall == true && defender.mobData.Value.fallPower > attacker.fallDefense) { return(FightResultEnum.ATTACKER_DIES); } break; default: throw new ArgumentOutOfRangeException(nameof(aDeathType), aDeathType, null); } } return(FightResultEnum.TIE); }