This commit is contained in:
yaoyanwei
2025-08-04 16:45:48 +08:00
parent 565aa16389
commit 2f2a601227
2296 changed files with 522745 additions and 93 deletions

View File

@@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TcgEngine.Gameplay;
namespace TcgEngine
{
/// <summary>
/// Effect that damages a card or a player (lose hp)
/// </summary>
[CreateAssetMenu(fileName = "effect", menuName = "TcgEngine/Effect/Damage", order = 10)]
public class EffectDamage : EffectData
{
public TraitData bonus_damage;
public override void DoEffect(GameLogic logic, AbilityData ability, Card caster, Player target)
{
int damage = GetDamage(logic.GameData, caster, ability.value);
logic.DamagePlayer(caster, target, damage);
}
public override void DoEffect(GameLogic logic, AbilityData ability, Card caster, Card target)
{
int damage = GetDamage(logic.GameData, caster, ability.value);
logic.DamageCard(caster, target, damage, true);
}
private int GetDamage(Game data, Card caster, int value)
{
Player player = data.GetPlayer(caster.player_id);
int damage = value + caster.GetTraitValue(bonus_damage) + player.GetTraitValue(bonus_damage);
return damage;
}
}
}