Beispiel #1
0
 public CombatAction Combat(Direction direction)
 {
     CombatAction action = new CombatAction();
     action.Attack = new SwipeAttack();
     action.Direction = direction;
     return action;
 }
Beispiel #2
0
        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;
        }
Beispiel #3
0
 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));
     }
 }