测试三阵营
This commit is contained in:
@@ -22,6 +22,16 @@ namespace TcgEngine
|
||||
public int attack = 0;
|
||||
public int hp = 0;
|
||||
|
||||
// 新增:三种元素法力值
|
||||
public int mana_fire = 0;
|
||||
public int mana_forest = 0;
|
||||
public int mana_water = 0;
|
||||
|
||||
// 新增:三种元素法力值的临时加成
|
||||
public int mana_fire_ongoing = 0;
|
||||
public int mana_forest_ongoing = 0;
|
||||
public int mana_water_ongoing = 0;
|
||||
|
||||
public int mana_ongoing = 0;
|
||||
public int attack_ongoing = 0;
|
||||
public int hp_ongoing = 0;
|
||||
@@ -45,11 +55,18 @@ namespace TcgEngine
|
||||
public Card(string card_id, string uid, int player_id) { this.card_id = card_id; this.uid = uid; this.player_id = player_id; }
|
||||
|
||||
public virtual void Refresh() { exhausted = false; }
|
||||
public virtual void ClearOngoing() { ongoing_status.Clear(); ongoing_traits.Clear(); ClearOngoingAbility(); attack_ongoing = 0; hp_ongoing = 0; mana_ongoing = 0; }
|
||||
public virtual void ClearOngoing()
|
||||
{
|
||||
ongoing_status.Clear(); ongoing_traits.Clear(); ClearOngoingAbility(); attack_ongoing = 0; hp_ongoing = 0; mana_ongoing = 0;
|
||||
// 新增:清除元素法力值临时加成
|
||||
mana_fire_ongoing = 0;
|
||||
mana_forest_ongoing = 0;
|
||||
mana_water_ongoing = 0;
|
||||
}
|
||||
|
||||
public virtual void Clear()
|
||||
{
|
||||
ClearOngoing(); Refresh(); damage = 0; status.Clear();
|
||||
ClearOngoing(); Refresh(); damage = 0; status.Clear();
|
||||
SetCard(CardData, VariantData); //Reset to initial stats
|
||||
equipped_uid = null;
|
||||
}
|
||||
@@ -67,7 +84,11 @@ namespace TcgEngine
|
||||
variant_id = cvariant.id;
|
||||
attack = icard.attack;
|
||||
hp = icard.hp;
|
||||
// 设置法力值
|
||||
mana = icard.mana;
|
||||
mana_fire = icard.mana_fire;
|
||||
mana_forest = icard.mana_forest;
|
||||
mana_water = icard.mana_water;
|
||||
SetTraits(icard);
|
||||
SetAbilities(icard);
|
||||
}
|
||||
@@ -93,7 +114,7 @@ namespace TcgEngine
|
||||
foreach (AbilityData ability in icard.abilities)
|
||||
AddAbility(ability);
|
||||
}
|
||||
|
||||
|
||||
//------ Custom Traits/Stats ---------
|
||||
|
||||
public void SetTrait(string id, int value)
|
||||
@@ -200,7 +221,7 @@ namespace TcgEngine
|
||||
all_traits.AddRange(ongoing_traits);
|
||||
return all_traits;
|
||||
}
|
||||
|
||||
|
||||
//Alternate names since traits/stats are stored in same var
|
||||
public void SetStat(string id, int value) => SetTrait(id, value);
|
||||
public void AddStat(string id, int value) => AddTrait(id, value);
|
||||
@@ -212,6 +233,27 @@ namespace TcgEngine
|
||||
public bool HasStat(string id) => HasTrait(id);
|
||||
public List<CardTrait> GetAllStats() => GetAllTraits();
|
||||
|
||||
// 新增:获取元素法力值的方法
|
||||
public virtual int GetManaFire() { return Mathf.Max(mana_fire + mana_fire_ongoing, 0); }
|
||||
public virtual int GetManaForest() { return Mathf.Max(mana_forest + mana_forest_ongoing, 0); }
|
||||
public virtual int GetManaWater() { return Mathf.Max(mana_water + mana_water_ongoing, 0); }
|
||||
|
||||
|
||||
// 新增:设置元素法力值的方法
|
||||
public void SetManaFire(int value) { mana_fire = value; }
|
||||
public void SetManaForest(int value) { mana_forest = value; }
|
||||
public void SetManaWater(int value) { mana_water = value; }
|
||||
|
||||
// 新增:增加元素法力值的方法
|
||||
public void AddManaFire(int value) { mana_fire += value; }
|
||||
public void AddManaForest(int value) { mana_forest += value; }
|
||||
public void AddManaWater(int value) { mana_water += value; }
|
||||
|
||||
// 新增:增加元素法力值临时加成的方法
|
||||
public void AddManaFireOngoing(int value) { mana_fire_ongoing += value; }
|
||||
public void AddManaForestOngoing(int value) { mana_forest_ongoing += value; }
|
||||
public void AddManaWaterOngoing(int value) { mana_water_ongoing += value; }
|
||||
|
||||
//------ Status Effects ---------
|
||||
|
||||
public void AddStatus(StatusData status, int value, int duration)
|
||||
@@ -331,8 +373,8 @@ namespace TcgEngine
|
||||
public void AddAbility(AbilityData ability)
|
||||
{
|
||||
abilities.Add(ability.id);
|
||||
if (abilities_data != null)
|
||||
abilities_data.Add(ability);
|
||||
if (abilities_data != null)
|
||||
abilities_data.Add(ability);
|
||||
}
|
||||
|
||||
public void RemoveAbility(AbilityData ability)
|
||||
@@ -457,7 +499,7 @@ namespace TcgEngine
|
||||
// return false;
|
||||
//if (!skip_cost && exhausted)
|
||||
// return false; //no more action
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool CanDoActivatedAbilities()
|
||||
@@ -484,13 +526,14 @@ namespace TcgEngine
|
||||
|
||||
//----------------
|
||||
|
||||
public CardData CardData
|
||||
{
|
||||
get {
|
||||
if(data == null || data.id != card_id)
|
||||
public CardData CardData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (data == null || data.id != card_id)
|
||||
data = CardData.Get(card_id); //Optimization, store for future use
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public VariantData VariantData
|
||||
@@ -507,7 +550,8 @@ namespace TcgEngine
|
||||
|
||||
public int Hash
|
||||
{
|
||||
get {
|
||||
get
|
||||
{
|
||||
if (hash == 0)
|
||||
hash = Mathf.Abs(uid.GetHashCode()); //Optimization, store for future use
|
||||
return hash;
|
||||
@@ -550,6 +594,14 @@ namespace TcgEngine
|
||||
dest.hp = source.hp;
|
||||
dest.mana = source.mana;
|
||||
|
||||
dest.mana_fire = source.mana_fire;
|
||||
dest.mana_forest = source.mana_forest;
|
||||
dest.mana_water = source.mana_water;
|
||||
|
||||
dest.mana_fire_ongoing = source.mana_fire_ongoing;
|
||||
dest.mana_forest_ongoing = source.mana_forest_ongoing;
|
||||
dest.mana_water_ongoing = source.mana_water_ongoing;
|
||||
|
||||
dest.mana_ongoing = source.mana_ongoing;
|
||||
dest.attack_ongoing = source.attack_ongoing;
|
||||
dest.hp_ongoing = source.hp_ongoing;
|
||||
@@ -560,8 +612,8 @@ namespace TcgEngine
|
||||
CardTrait.CloneList(source.ongoing_traits, dest.ongoing_traits);
|
||||
CardStatus.CloneList(source.status, dest.status);
|
||||
CardStatus.CloneList(source.ongoing_status, dest.ongoing_status);
|
||||
GameTool.CloneList(source.abilities, dest.abilities);
|
||||
GameTool.CloneList(source.abilities_ongoing, dest.abilities_ongoing);
|
||||
GameTool.CloneList(source.abilities, dest.abilities);
|
||||
GameTool.CloneList(source.abilities_ongoing, dest.abilities_ongoing);
|
||||
GameTool.CloneListRefNull(source.abilities_data, ref dest.abilities_data); //No need to deep copy since AbilityData doesn't change dynamically, its just a reference
|
||||
}
|
||||
|
||||
@@ -615,7 +667,7 @@ namespace TcgEngine
|
||||
}
|
||||
}
|
||||
|
||||
if(dest.Count > source.Count)
|
||||
if (dest.Count > source.Count)
|
||||
dest.RemoveRange(source.Count, dest.Count - source.Count);
|
||||
}
|
||||
}
|
||||
@@ -641,7 +693,8 @@ namespace TcgEngine
|
||||
this.permanent = (duration == 0);
|
||||
}
|
||||
|
||||
public StatusData StatusData {
|
||||
public StatusData StatusData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (data == null || data.effect != type)
|
||||
|
||||
Reference in New Issue
Block a user