using DominionBase.Enums; using DominionBase.Players; using System; using System.Diagnostics.Contracts; using System.Linq; namespace DominionBase.Cards.Seaside2ndEdition { public static class TypeClass { public static readonly Type Ambassador = typeof(Ambassador); public static readonly Type Cutpurse = typeof(Cutpurse); public static readonly Type Embargo = typeof(Embargo); public static readonly Type Explorer = typeof(Explorer); public static readonly Type GhostShip = typeof(GhostShip); public static readonly Type Haven = typeof(Haven); public static readonly Type Island = typeof(Island); public static readonly Type Lighthouse = typeof(Lighthouse); public static readonly Type Lookout = typeof(Lookout); public static readonly Type NativeVillage = typeof(NativeVillage); public static readonly Type Navigator = typeof(Navigator); public static readonly Type Outpost = typeof(Outpost); public static readonly Type PirateShip = typeof(PirateShip); public static readonly Type Salvager = typeof(Salvager); public static readonly Type SeaHag = typeof(SeaHag); public static readonly Type Smugglers = typeof(Smugglers); public static readonly Type Tactician = typeof(Tactician); public static readonly Type TreasureMap = typeof(TreasureMap); public static readonly Type Treasury = typeof(Treasury); } public class Ambassador : Seaside.Ambassador { public Ambassador() : base(Edition.Second) { } } public class Cutpurse : Seaside.Cutpurse { public Cutpurse() : base(Edition.Second) { } } public class Embargo : Seaside.Embargo { public Embargo() : base(Edition.Second) { } } public class Explorer : Seaside.Explorer { public Explorer() : base(Edition.Second) { } } public class GhostShip : Seaside.GhostShip { public GhostShip() : base(Edition.Second) { } } public class Haven : Seaside.Haven { public Haven() : base(Edition.Second) { } } public class Island : Seaside.Island { public Island() : base(Edition.Second) { } } public class Lighthouse : Seaside.Lighthouse { public Lighthouse() : base(Edition.Second) { } } public class Lookout : Seaside.Lookout { public Lookout() : base(Edition.Second) { } } public class NativeVillage : Seaside.NativeVillage { public NativeVillage() : base(Edition.Second) { } } public class Navigator : Seaside.Navigator { public Navigator() : base(Edition.Second) { } } public class Outpost : Card { public Outpost() : base(Categories.Action | Categories.Duration, Source.Seaside, Location.Kingdom, Traits.Basic | Traits.Terminal, edition: Edition.Second) { BaseCost = new Cost(5); } protected override bool AllowUndo => true; public override void TearDown(IGame game) { Contract.Requires(game != null, "game cannot be null"); base.TearDown(game); foreach (var player in game.Players) { player.DrawNewHand -= Player_DrawNewHand; player.TurnEnded -= Player_TurnEnded; } } public override void FollowInstructions(IPlayer player) { Contract.Requires(player != null, "player cannot be null"); base.FollowInstructions(player); if (player.CurrentTurn.CardsPlayed.Count(c => c is Outpost) == 1 && (player._Game.TurnsTaken.Count <= 1 || player._Game.TurnsTaken[player._Game.TurnsTaken.Count - 2].Player != player)) { CanCleanUpPlayed.Add(false); player.DrawNewHand += Player_DrawNewHand; player.TurnEnded += Player_TurnEnded; } else CanCleanUpPlayed.Add(true); } private void Player_DrawNewHand(object sender, DrawNewHandEventArgs e) { if (e.Resolvers.ContainsKey(TypeClass.Outpost) || e.HandledBy.Contains(this)) return; e.Resolvers[TypeClass.Outpost] = new DrawNewHandResolver(this, $"Resolve {this}", Player_Action, true); } internal void Player_Action(IPlayer player, ref DrawNewHandEventArgs e) { e.DrawSize = 3; player._Game.SendMessage(player, this, e.DrawSize); e.HandledBy.Add(this); } private void Player_TurnEnded(object sender, TurnEndedEventArgs e) { var player = sender as IPlayer; e.NextPlayer = e.Player; e.NextGrantedBy = this; CanCleanUpPlayed.Remove(false); player.DrawNewHand -= Player_DrawNewHand; player.TurnEnded -= Player_TurnEnded; } } public class PirateShip : Seaside.PirateShip { public PirateShip() : base(Edition.Second) { } } public class Salvager : Seaside.Salvager { public Salvager() : base(Edition.Second) { } } public class SeaHag : Seaside.SeaHag { public SeaHag() : base(Edition.Second) { } } public class Smugglers : Seaside.Smugglers { public Smugglers() : base(Edition.Second) { } } public class Tactician : Seaside.Tactician { public Tactician() : base(Edition.Second) { } } public class TreasureMap : Seaside.TreasureMap { public TreasureMap() : base(Edition.Second) { } } public class Treasury : Seaside.Treasury { public Treasury() : base(Edition.Second) { } } }