string Hero(HS_PlayerInstance player) { if (player != game.CurrentPlayer) { return("It's not your turn"); } if (player.Mana < 2) { return("Not enough mana"); } if (player.UsedHero) { return("You already used hero power this turn"); } Broadcast(player.Name + " created Soldier (Hero)"); player.UsedHero = true; player.SpendMana(2); HS_CreatureInstance ci = new HS_CreatureInstance("Soldier", new HS_CreatureCard(1, 1, new List <HS_CreatureType>(new HS_CreatureType[] { HS_CreatureType.Beast }), "", 1, "a", HS_CardRarity.Common, HS_CardType.Creature, null)); game.Battlefield.AddCreature(player, ci); return(""); }
string Attack(HS_PlayerInstance callingPlayer, string[] args) { string response = ""; try { HS_PlayerInstance targetPlayer = game.CurrentPlayers[Convert.ToInt32(args[1])]; if (callingPlayer == targetPlayer) { return("You can't attack yourself\n"); } sbyte fromIndex = Convert.ToSByte(args[2]); HS_CreatureInstance from = game.Battlefield.GetField(callingPlayer)[fromIndex]; if (!from.CanAttack) { return("This creature can't attack."); } sbyte toIndex = Convert.ToSByte(args[3]); HS_CreatureInstance to = null; if (toIndex >= 0) { to = game.Battlefield.GetField(targetPlayer)[toIndex]; } game.Battlefield.Attack(callingPlayer, fromIndex, targetPlayer, toIndex); from.AlreadyAttacked = true; if (!targetPlayer.Alive && toIndex == -1) { return("Can't attack a dead player."); } string attacktarget = targetPlayer.Name; if (toIndex >= 0) { attacktarget += "'s " + to.Name; } Broadcast(callingPlayer.Name + " attacks " + attacktarget + " with " + from.Name); } catch (Exception e) { response = "Invalid attack command\n"; } return(response); }