public CombatAction Combat(Direction direction) { CombatAction action = new CombatAction(); action.Attack = new SwipeAttack(); action.Direction = direction; return action; }
public override ActionResult Process(Actor actor, Game game) { int newX = RTools.GetX(actor.X, Direction); int newY = RTools.GetY(actor.Y, Direction); // is space off map if (!game.Map.CheckLimits(newX, newY)) { return ActionResult.Fail; // fail } // Is space collision free Tile tile = game.Map.Tiles[newY][newX]; if (tile.IsSolid) { return ActionResult.Fail; //fail } if (tile.Actor != null) { if (tile.Actor.IsPlayable == !(actor.IsPlayable)) { CombatAction action = new CombatAction(); action.Attack = new SwipeAttack(); action.Direction = Direction; AlternateAction = action; return ActionResult.Alternate; } else { return ActionResult.Fail; } }//fail Move(actor, tile); return ActionResult.Success; }
public void ReportCombat(CombatAction action, Actor owner) { if (action.Defender == null) { Display.Info("No one to attack"); } else { Display.Info(String.Format("{2} gave {0} ({3}hp) {1} dmg", action.Defender.Name, action.Damage, owner.Name, action.Defender.Health)); if (action.Defender.Health == 0) Display.Info(String.Format("{1} killed {0}!", action.Defender.Name, owner.Name)); } }