代码如下,在SilverFishSilverFishaiPlayfield.cs文件中
public void callKid(CardDB.Card c, int zonepos, bool own, bool spawnKid = true, bool oneMoreIsAllowed = false) { int allowed = 7; allowed += (oneMoreIsAllowed) ? 1 : 0; if (own) { if (this.ownMinions.Count >= allowed) { if (spawnKid) this.evaluatePenality += 10; else this.evaluatePenality += 20; return; } } else { if (this.enemyMinions.Count >= allowed) { if (spawnKid) this.evaluatePenality -= 10; else this.evaluatePenality -= 20; return; } } int mobplace = zonepos + 1; //create minion (+triggers) Handmanager.Handcard hc = new Handmanager.Handcard(c) { entity = this.getNextEntity() }; Minion m = createNewMinion(hc, mobplace, own); //put it on battle field (+triggers) addMinionToBattlefield(m); }
虚空领主为例子
Voidlord
虚空领主
{
"Entity": {
"CardId": "LOOT_368",
"LocStringZhCn": "<b>嘲讽,亡语:</b> 召唤三个1/3并具有<b>嘲讽</b>的恶魔。",
"LocStringEnUs": "[x]<b>Taunt</b> <b>Deathrattle:</b> Summon three 1/3 Demons with <b>Taunt</b>.",
情况分析,
假如场上已经有7个随从了,那么虚空领主死亡,只能召唤1个随从。
假如场上已经有6个随从了,那么虚空领主死亡,只能召唤2个随从。
假如场上已经有5个或者更少的随从,那么虚空领主死亡,可以召唤3个随从。
虚空领主的simulation实现在github上
https://github.com/ChuckHearthBuddy/SilverFish/blob/master/SilverFish/cards/LOOT/Sim_LOOT_368.cs
另外,CallKid函数需要加上注释
/// <summary> /// /// </summary> /// <param name="card"></param> /// <param name="zonePosition"></param> /// <param name="own"></param> /// <param name="spawnKid">call kid triggered by another minion</param> /// <param name="oneMoreIsAllowed">for deathrattle minion to call kid(such as Voidlord)</param> public void CallKid(CardDB.Card card, int zonePosition, bool own, bool spawnKid = true, bool oneMoreIsAllowed = false) { int allowed = 7; allowed += (oneMoreIsAllowed) ? 1 : 0; if (own) { if (this.ownMinions.Count >= allowed) { if (spawnKid) this.evaluatePenality += 10; else this.evaluatePenality += 20; return; } } else { if (this.enemyMinions.Count >= allowed) { if (spawnKid) this.evaluatePenality -= 10; else this.evaluatePenality -= 20; return; } } int mobplace = zonePosition + 1; //create minion (+triggers) Handmanager.Handcard hc = new Handmanager.Handcard(card) { entity = this.getNextEntity() }; Minion m = createNewMinion(hc, mobplace, own); //put it on battle field (+triggers) addMinionToBattlefield(m); }