public void RangedAct() { ReplayRecorder recorder = new ReplayRecorder(); recorder.RecordStartFrame(this); foreach (var item in Map.Army.ToArray()) { if (item.HP <= 0) { continue; } if (item is RangedArmyBase ranged) { ranged.RangedMove(Map); } } recorder.RecordEndFrame(this); ReplayOrganizer.AddFrame(recorder); ReplayRecorder recorder2 = new ReplayRecorder(); recorder2.RecordStartFrame(this, true); foreach (var item in Map.Army.ToArray()) { if (item is RangedArmyBase ranged) { ranged.RangedAttack(Map); } } recorder2.RecordEndFrame(this); ReplayOrganizer.AddFrame(recorder2); }
public int?Turn(int turnnum) { foreach (var player in Players) { player.Cost += 3; } ReplayRecorder recorder = new ReplayRecorder(); recorder.RecordStartFrame(this); var x = PlayerMoveHelper(0, 1); if (x is int propagResult) { return(propagResult); } x = PlayerMoveHelper(1, 0); if (x is int propagResult2) { return(propagResult2); } recorder.RecordEndFrame(this); ReplayOrganizer.AddFrame(recorder, true); MeleeAct(); RangedAct(); MapAct(); if (Players[0].Base <= 0 && Players[1].Base > 0) { return(1); } if (Players[1].Base <= 0 && Players[0].Base > 0) { return(0); } if (Players[1].Base <= 0 && Players[0].Base <= 0) { return(-1); } if (turnnum >= 200) { if (Players[0].Base > Players[1].Base) { return(0); } else if (Players[0].Base < Players[1].Base) { return(1); } else { return(-1); } } return(null); }
public void MeleeAct() { ReplayRecorder recorder = new ReplayRecorder(); recorder.RecordStartFrame(this); foreach (var item in Map.Army.ToArray()) { if (item.HP <= 0) { continue; } if (item is MeleeArmyBase melee) { melee.MeleeMove(Map); } } recorder.RecordEndFrame(this); ReplayOrganizer.AddFrame(recorder); }
public void MapAct() { ReplayRecorder recorder = new ReplayRecorder(); recorder.RecordStartFrame(this); foreach (var item in Map.Army) { item.BreakMove(Map); if (item.PosY == Players[0].BasePosY && item.Owner == Players[1]) { Players[0].Base -= item.BreakingPower; } if (item.PosY == Players[1].BasePosY && item.Owner == Players[0]) { Players[1].Base -= item.BreakingPower; } } recorder.RecordEndFrame(this); ReplayOrganizer.AddFrame(recorder); }