SCard(SCardName name, SClan clan, SRarity rarity, int defaultPower, params STag[] tags) { _player = -1; _location = new SLocation(); _rarity = rarity; _clan = clan; _id = _ids++; _name = name; _status = new SStatus(); _power = new SPower(defaultPower); _tags = tags.ToList(); _triggers = new Dictionary <STType, STrigger>(); _timer = STimer.none(); }
public void move(SCard card, SLocation moveTo) { foreachPlayer((p) => { log(String.Format("mv {0} {1}←{2} p{3}", cardView(card, p), moveTo, card.location, card.host), p); }); }
public bool Equals(SLocation location) { return(_place == location._place); }
public SLocationView(SLocation location, int indexInPlace, int hostIndex) { _location = location; _index = indexInPlace; _host = hostIndex; }
// do not execute any triggers // so, cant be used for group movement // or group killing / banishing public void setLocation(SLocation location) { foreachCard((c) => { c.location = location; }); }
public SCards move(SLocation location) { List <STType> triggers = new List <STType>(); foreachCard((c) => { STType trigger = STType.none; // see what to trigger on movement if (location.place == SPlace.board) { trigger = c.location.place == SPlace.graveyard ? STType.onRessurect : STType.onDeploy; } // if moven to graveyard // from hand = discard // from board = die -> then // trigger deathwish // if just moved from board to graveyard // then prevent onDie effect // from the higher level if (location.place == SPlace.graveyard) { if (c.location.place == SPlace.hand) { trigger = STType.onDiscard; } if (c.location.place == SPlace.board) { trigger = STType.onDie; //c.containsTag(STag.doomed) } } if (location.place == SPlace.banish && c.location.place == SPlace.board) { trigger = STType.onBanish; } // when back to deck // shuffled when from board/graveyard // otherwise swapped if (location.place == SPlace.deck) { trigger = c.location.place == SPlace.hand ? STType.onSwap : STType.onShuffle; } // from deck to hand if (location.place == SPlace.hand && c.location.place == SPlace.deck) { trigger = STType.onDraw; } // trigger moe when still on board, // but a row changed if (location.Equals(c.location) && location.place == SPlace.board && location.row != c.location.row) { trigger = STType.onMove; } // then move and remember trigger // SLocation prevLocation = c.location; c.game.logger.move(c, location); c.location = location; triggers.Add(trigger); }); // after all cards moved // trigger in order their deploys, // deathwishes or whatever for (int i = 0; i < triggers.Count; ++i) { if (triggers[i] != STType.none) { _cards[i].trigger(triggers[i]); } } return(this); }