public async Task AttachMech(Upgrade mech, GameHandler gameHandler, ulong curPlayer, ulong enemy, CommandContext ctx) { ExtraEffectInfo extraInf = new ExtraEffectInfo(ctx); await Effect.CallEffects(mech.effects, Effect.EffectType.OnPlay, mech, gameHandler, curPlayer, enemy, extraInf); if (mech.creatureData.staticKeywords[StaticKeyword.Magnetic] > 0) { for (int i = 0; i < mech.creatureData.staticKeywords[StaticKeyword.Magnetic]; i++) { await PlayerInteraction.ActivateMagneticAsync(gameHandler, curPlayer, enemy, ctx); } } if (mech.creatureData.staticKeywords[StaticKeyword.Echo] > 0) { gameHandler.players[curPlayer].shop.AddUpgrade(mech.BasicCopy(gameHandler.players[curPlayer].pool)); } if (mech.creatureData.staticKeywords[StaticKeyword.Binary] > 0) { mech.creatureData.staticKeywords[StaticKeyword.Binary]--; Upgrade binaryLessCopy = mech.BasicCopy(gameHandler.players[curPlayer].pool); binaryLessCopy.cardText += " (No Binary)"; binaryLessCopy.creatureData.staticKeywords[StaticKeyword.Binary]--; //the copy should have basic stats gameHandler.players[curPlayer].hand.AddCard(binaryLessCopy); } mech.creatureData.staticKeywords[StaticKeyword.Binary] = 0; this.creatureData += mech.creatureData; this.creatureData.staticKeywords[StaticKeyword.Echo] = 0; this.creatureData.staticKeywords[StaticKeyword.Magnetic] = 0; this.creatureData.staticKeywords[StaticKeyword.Freeze] = 0; this.creatureData.staticKeywords[StaticKeyword.Binary] = 0; //await mech.Battlecry(gameHandler, curPlayer, enemy); await Effect.CallEffects(mech.effects, Effect.EffectType.Battlecry, mech, gameHandler, curPlayer, enemy, extraInf); if (gameHandler.players[curPlayer].playHistory[gameHandler.players[curPlayer].playHistory.Count() - 1].Count() > 0) { await Effect.CallEffects(mech.effects, Effect.EffectType.Combo, mech, gameHandler, curPlayer, enemy, extraInf); } this.attachedUpgrades.Add((Upgrade)mech.DeepCopy()); foreach (var upgradeEffect in mech.effects) { this.effects.Add(upgradeEffect.Copy()); } }
public void TransformUpgrade(int index, Upgrade m) { if (index < 0 || index >= this.options.Count()) { return; } else if (this.options[index].name == BlankUpgrade.name) { return; } this.options[index] = (Upgrade)m.DeepCopy(); }
public async Task AttachMech(Upgrade mech, GameHandler gameHandler, int curPlayer, int enemy) { await mech.OnPlay(gameHandler, curPlayer, enemy); foreach (var extraEffect in mech.extraUpgradeEffects) { await extraEffect.OnPlay(gameHandler, curPlayer, enemy); } if (mech.creatureData.staticKeywords[StaticKeyword.Magnetic] > 0) { for (int i = 0; i < mech.creatureData.staticKeywords[StaticKeyword.Magnetic]; i++) { await PlayerInteraction.ActivateMagneticAsync(gameHandler, curPlayer, enemy); } } if (mech.creatureData.staticKeywords[StaticKeyword.Echo] > 0) { gameHandler.players[curPlayer].shop.AddUpgrade(mech.BasicCopy(gameHandler.players[curPlayer].pool)); } if (mech.creatureData.staticKeywords[StaticKeyword.Binary] > 0) { mech.creatureData.staticKeywords[StaticKeyword.Binary]--; Upgrade binaryLessCopy = mech.BasicCopy(gameHandler.players[curPlayer].pool); binaryLessCopy.cardText += " (No Binary)"; binaryLessCopy.creatureData.staticKeywords[StaticKeyword.Binary]--; //the copy should have basic stats gameHandler.players[curPlayer].hand.AddCard(binaryLessCopy); } mech.creatureData.staticKeywords[StaticKeyword.Binary] = 0; this.creatureData += mech.creatureData; this.creatureData.staticKeywords[StaticKeyword.Echo] = 0; this.creatureData.staticKeywords[StaticKeyword.Magnetic] = 0; this.creatureData.staticKeywords[StaticKeyword.Freeze] = 0; this.creatureData.staticKeywords[StaticKeyword.Binary] = 0; await mech.Battlecry(gameHandler, curPlayer, enemy); foreach (var extraEffect in mech.extraUpgradeEffects) { await extraEffect.Battlecry(gameHandler, curPlayer, enemy); } if (gameHandler.players[curPlayer].playHistory[gameHandler.players[curPlayer].playHistory.Count() - 1].Count() > 0) { mech.Combo(gameHandler, curPlayer, enemy); foreach (var extraEffect in mech.extraUpgradeEffects) { extraEffect.Combo(gameHandler, curPlayer, enemy); } } this.attachedMechs.Add((Upgrade)mech.DeepCopy()); foreach (var extraEffect in mech.extraUpgradeEffects) { this.extraUpgradeEffects.Add((Upgrade)extraEffect.DeepCopy()); } }
public int AddUpgrade(Upgrade m) { this.options.Add((Upgrade)m.DeepCopy()); return(this.options.Count() - 1); }