public SCards range(List <int> indices) { SCards rangeCards = new SCards(); for (int i = 0; i < indices.Count; ++i) { rangeCards.addCard(_cards[indices[i]]); } return(rangeCards); }
// returns list of // ticked cards public SCards tick(int X = 1) { SCards finished = new SCards(); foreachCard((c) => { if (c.timer.tick(X)) { finished.addCard(c); } }); return(finished); }
// damage all selected units by specified X // returns count of units died this way public SCards damage(int X, SCard source = null) { SCards banish = new SCards(); SCards dead = new SCards(); SCards armorLost = new SCards(); List <int> recived = new List <int>(); foreachCard((c) => { SHitResult hitResult = c.power.damage(X); recived.Add(hitResult.healthLost); if (hitResult.shouldBeDead) { (c.containsTag(STag.doomed)? banish : dead).addCard(c); } else if (hitResult.armorWasBroken) { armorLost.addCard(c); } }); // (using foreachCard of daed/armorLost) // move dead group to graveyard // trigger their deathwishes // if dead, but has doomed // move it to banish instead // and do not trigger deathwish // trigger all armorLost units // on armorlost triggers // rest non-dead and non-banished // trigger for damaged // then return all killed cards // killed = banished + dead foreachCard((c) => { int damagedFor = recived[_cards.IndexOf(c)]; if (!dead.contains(c) && !banish.contains(c) && damagedFor > 0) { c.trigger(STType.onDamaged, source, damagedFor); } if (armorLost.contains(c)) { c.trigger(STType.onArmorLost); } }); dead.move(SPlace.graveyard); banish.move(SPlace.banish); return(dead.addCards(banish)); }
public SCards defaultCopy() { SCards res = new SCards(); foreachCard((c) => { res.addCard(c.defaultCopy()); }); return(res); }
public SCards unite(SCards[] scards) { SCards res = new SCards(); foreachCard((c) => { res.addCard(c); }); return(res); }