public void HandleFusion() { List <CardVisual> targets = Finder.FindAllCardsInZone(DeckType.Battlefield, Keywords.Fusion, OwnerConstraints.Mine); if (targets.Count < 2) { return; } List <SpecialAbility.StatAdjustment> totalStats = new List <SpecialAbility.StatAdjustment>(); for (int i = 0; i < targets.Count; i++) { totalStats.AddRange(SpecialAbility.StatAdjustment.CopyStats(targets[i] as CreatureCardVisual)); if (targets[i].keywords.Contains(Keywords.Interceptor)) { ((CreatureCardVisual)targets[i]).battlefieldPos.position -= ((CreatureCardVisual)targets[i]).interceptPos; } targets[i].currentDeck.RPCTransferCard(PhotonTargets.All, targets[i], owner.theVoid); } totalStats.AddRange(SpecialAbility.StatAdjustment.CreateStatSet(1, 1, 1)); int totalAtk = 0; int totalSiz = 0; int totalHth = 0; for (int i = 0; i < totalStats.Count; i++) { switch (totalStats[i].stat) { case Constants.CardStats.Attack: totalAtk += totalStats[i].value; break; case Constants.CardStats.Size: totalSiz += totalStats[i].value; break; case Constants.CardStats.Health: totalHth += totalStats[i].value; break; } } string cardDataName = "FusedSoul"; CardData tokenData = Resources.Load <CardData>("CardData/" + cardDataName) as CardData; CardVisual newFusion = owner.activeGrimoire.GetComponent <Deck>().CardFactory(tokenData, GlobalSettings._globalSettings.creatureCard.name, owner.battlefield); newFusion.RPCSetCardStats(PhotonTargets.All, totalStats.Count, totalAtk, totalSiz, totalHth); }
public CardVisual SpawnTokenWithCopiedStats(CardVisual target) { CardData tokenData = Resources.Load <CardData>("CardData/" + spawnableTokenDataName) as CardData; CardVisual tokenCard = SpawnBaseToken(tokenData, GetCardPrefabName(spawnCardType)); if (target is CreatureCardVisual) { CreatureCardVisual soul = target as CreatureCardVisual; tokenCard.RPCSetCardStats(PhotonTargets.All, soul.essenceCost, soul.attack, soul.size, soul.maxHealth); } return(tokenCard); }