public Card CreateToken(CardContainer initial_container, Card card_to_create, int position = -1) { if (initial_container.full && initial_container.zone != Zone.equipment) { return(null); } Card card = Instantiate(card_to_create); if (card.type == CardType.Creature && initial_container.zone == Zone.field) { (card as Creature).NoteSummon(); foreach (TriggerInstance ti in trigger_manager.GetTriggers(new WheneverCreatureSummonedInfo(card as Creature))) { AddToStack(ti); } } if (card.type == CardType.Weapon && initial_container.zone == Zone.equipment) { Weapon weapon = card as Weapon; if (weapon != null) { weapon.NoteSummon(); if (initial_container.controller.equip.TopCard() != null) { MoveCard(initial_container.controller.equip.TopCard(), initial_container.controller.graveyard); initial_container.controller.SetWeapon(null); } } } if (position >= 0) { initial_container.AddCard(card, position); } else { initial_container.AddCard(card); } if (card.type == CardType.Weapon && initial_container.zone == Zone.equipment) { Weapon weapon = card as Weapon; weapon.controller.SetWeapon(weapon); } SubscribeEffects(card); return(card); }
protected override void Execute(List <CardEntity> entities) { foreach (var e in entities) { _shareDeck.AddCard(e.view.GameObject); } }
public static void MoveCard(Card c, CardContainer from, CardContainer to, int position) { from.RemoveCard(c); to.AddCard(c, position); }
public static void MoveCard(Card c, CardContainer from, CardContainer to) { from.RemoveCard(c); to.AddCard(c); }