修复击杀钩子,添加技能

This commit is contained in:
xianyi
2025-09-02 16:20:42 +08:00
parent 1386d7d431
commit 88006275ca
53 changed files with 1023 additions and 27 deletions

View File

@@ -16,6 +16,8 @@ namespace TcgEngine
public TeamData has_team;
public TraitData has_trait;
public CardCamp has_camp;
public RarityData has_rarity;
public RarityData exclude_rarity;
public ConditionOperatorBool oper;
@@ -40,7 +42,9 @@ namespace TcgEngine
bool is_team = target.team == has_team || has_team == null;
bool is_trait = target.HasTrait(has_trait) || has_trait == null;
bool is_camp = target.camp == has_camp || has_camp == CardCamp.None;
return (is_type && is_team && is_trait && is_camp);
bool is_rarity = target.rarity == has_rarity || has_rarity == null;
bool not_excluded_rarity = target.rarity != exclude_rarity || exclude_rarity == null;
return (is_type && is_team && is_trait && is_camp && is_rarity && not_excluded_rarity);
}
private bool IsTrait(Card card)
@@ -49,7 +53,9 @@ namespace TcgEngine
bool is_team = card.CardData.team == has_team || has_team == null;
bool is_trait = card.HasTrait(has_trait) || has_trait == null;
bool is_camp = card.CardData.camp == has_camp || has_camp == CardCamp.None;
return (is_type && is_team && is_trait && is_camp);
bool is_rarity = card.CardData.rarity == has_rarity || has_rarity == null;
bool not_excluded_rarity = card.CardData.rarity != exclude_rarity || exclude_rarity == null;
return (is_type && is_team && is_trait && is_camp && is_rarity && not_excluded_rarity);
}
}
}

View File

@@ -35,6 +35,32 @@ namespace TcgEngine
int target_hp_before = target != null ? target.GetHP() : 0;
bool will_kill = target != null && target_hp_before <= damage;
// 无敌状态
if (target.HasStatus(StatusType.Invincibility))
{
will_kill = false;
}
// 免疫伤害
if (target.HasStatus(StatusType.Shell))
{
Debug.Log("目标处于贝壳状态,免疫本次伤害");
will_kill = false;
}
int armor_reduction = 0;
int damageBeforeArmor = 0;
// 护甲状态
if (target.HasStatus(StatusType.Armor))
{
armor_reduction = target.GetStatusValue(StatusType.Armor);
damageBeforeArmor = Mathf.Max(0, damage - armor_reduction);
if (damageBeforeArmor > 0)
{
will_kill = false;
}
}
// 造成伤害
logic.DamageCard(caster, target, damage, true);