描述
法術迸發 (EN:Spellburst ) 是一種在《通靈學園》中加入的關鍵字異能,在玩家打出一張法術牌后觸發,只能觸發一次。
- 若隨從在法術結算過程中死亡,則不會觸發效果
思路
首先一定可以從場上隨從的entity(實體)上讀取GAME_TAG從而讀取到是否可以進行法術迸發的狀態。
在使用一張法術牌之后遍歷一下隨從,再檢查一下武器的法術迸發狀態,從而執行法術迸發操作。故想到添加一個 SimTemplate
可以做到統一寫法。
執行
主程序內部添加法術迸發的GAME_TAG
-
在
Triton.Game.Mapping.GAME_TAG
加入法術迸發的枚舉SPELLBURST = 1427
這一步的要求是需要有無殼的主程序或有源碼,沒有無殼主程序可以不做第1步,繼續向下做,遇到紅色字體時選擇對應的其他步驟
(右鍵編輯類,加入枚舉,然后編譯。編譯后記得保存。)
2021/1/13補充:貼吧發布的20210109折騰版已經更新當時的最新 GAME_TAG
,所以第一步不需要做了
在 CardDB.cs 中添加 Spellburst
屬性
-
聲明屬性
private bool spellburst = false; public bool Spellburst { get { return spellburst; } set { spellburst = value; } }
-
添加解析 CardDefs.xml 文件時對
Spellburst
的讀取case 1427: c.Spellburst = value == 1; break;//法術迸發
在 Minion.cs 中添加 Spellburst
屬性
-
聲明屬性,與 CardDB.cs 中相同
-
在構造器中添加
Spellburst
this.Spellburst = m.Spellburst;
-
在
setMinionToMinion
方法中添加Spellburst
this.Spellburst = m.Spellburst;
在 Weapon.cs 中添加 Spellburst
屬性
-
聲明屬性,與 CardDB.cs 中相同
-
在構造器中、
isEqual
方法中、equip
方法中添加Spellburst
仿照其他格式與 Minion.cs 中的添加方式添加即可
在 silverfish_HB.cs 中添加隨從和武器法術迸發狀態的讀取
在這一步中,遇到 GAME_TAG.SPELLBURST
要替換成 (GAME_TAG)1427
//在相應位置添加
ownWeapon.Spellburst = (weapon.GetTag(GAME_TAG.SPELLBURST) == 1) ? true : false;
enemyWeapon.Spellburst = (weapon.GetTag(GAME_TAG.SPELLBURST) == 1) ? true : false;
m.Spellburst = (entitiy.GetTag(GAME_TAG.SPELLBURST) == 0) ? false : true;
//若Spellburst為true,則打出法術后能觸發其法術迸發效果
在 SimTemplate.cs 中添加虛函數
/// <summary>
/// 法術迸發(隨從)
/// </summary>
/// <param name="p">場面</param>
/// <param name="m">法術迸發的隨從</param>
/// <param name="hc">觸發法術迸發的手牌</param>
public virtual void onSpellburst(Playfield p, Minion m, Handmanager.Handcard hc)
{
return;
}
/// <summary>
/// 法術迸發(武器)
/// </summary>
/// <param name="p">場面</param>
/// <param name="w">法術迸發的武器</param>
/// <param name="hc">觸發法術迸發的手牌</param>
public virtual void onSpellburst(Playfield p, Weapon w, Handmanager.Handcard hc)
{
return;
}
在 Playfield.cs 中添加法術迸發的觸發
搜索 onCardplay
,有3處結果,其中有一處是我方打出法術/武器牌的位置,在這之后添加法術迸發的觸發
//法術迸發
foreach (Minion m in this.ownMinions.ToArray())
{
if (m.Spellburst == true && !m.silenced)
{
m.handcard.card.sim_card.onSpellburst(this, m, hc);
m.Spellburst = false;
}
}
if (this.ownWeapon.Spellburst == true)
{
this.ownWeapon.card.sim_card.onSpellburst(this, this.ownWeapon, hc);
this.ownWeapon.Spellburst = false;
}
其余內容
-
沉默使隨從的
Spellburst
屬性發生改變在 Minion.cs 的
becomeSilence
方法中添加Spellburst = false;
-
2021年2月11日補充:在 Playfield.cs 的
isEqual
方法中對應處添加
至此添加完畢。
例子
using System;
using System.Collections.Generic;
using System.Text;
namespace HREngine.Bots
{
class Sim_SCH_231 : SimTemplate //* 新生刺頭 Intrepid Initiate
{
//<b>Spellburst:</b> Gain +2_Attack.
//<b>法術迸發:</b>獲得+2攻擊力。
public override void onSpellburst(Playfield p, Minion m,Handmanager.Handcard hc)
{
p.minionGetBuffed(m, 2, 0);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace HREngine.Bots
{
class Sim_SCH_182 : SimTemplate //* 演講者吉德拉 Speaker Gidra
{
//[x]<b><b>Rush</b>, Windfury</b><b><b>Spellburst</b>:</b> GainAttackand Health equal tothe spell's Cost.
//<b>突襲,風怒</b><b>法術迸發:</b>獲得等同於法術法力值消耗的攻擊力和生命值。
public override void onSpellburst(Playfield p, Minion m,Handmanager.Handcard hc)
{
p.minionGetBuffed(m, hc.manacost, hc.manacost);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace HREngine.Bots
{
class Sim_SCH_248 : SimTemplate //* 甩筆侏儒 Pen Flinger
{
//<b>Battlecry:</b> Deal 1 damage. <b>Spellburst:</b> Return thisto_your hand.
//<b>戰吼:</b>造成1點傷害。<b>法術迸發:</b>將該隨從移回你的手牌。
public override void getBattlecryEffect(Playfield p, Minion own, Minion
target, int choice)
{
if (target != null) p.minionGetDamageOrHeal(target, 1);
}
public override void onSpellburst(Playfield p, Minion m,Handmanager.Handcard hc)
{
p.minionReturnToHand(m, m.own, 0);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace HREngine.Bots
{
class Sim_SCH_523 : SimTemplate //* 儀式重槌 Ceremonial Maul
{
//<b>Spellburst</b>: Summon a Student with <b>Taunt</b> and stats equalto the spell's Cost.
//<b>法術迸發:</b>召喚一個屬性值等同於法術法力值消耗的並具有<b>嘲諷</b>的學生。
CardDB.Card weapon = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.SCH_523);
CardDB.Card kid = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.SCH_523t);
public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
{
p.equipWeapon(weapon, ownplay);
}
public override void onSpellburst(Playfield p, Weapon w,Handmanager.Handcard hc)
{
int place = p.ownMinions.Count;
if (place < 7)
{
p.callKid(kid, place, true);
p.minionSetAngrToX(p.ownMinions[place-1], hc.manacost);//有的silverfish里是minionSetAttackToX
p.minionSetLifetoX(p.ownMinions[place-1], hc.manacost);
}
}
}
}