public void DispatchBlockableDamage(BattleActorBase attacker, int damage = 0) { DispatchBlockableDamage(new List <BattleActorBase>() { attacker }, damage); }
public StatusEffect(Stat effect, BattleActorBase linkedActor, int duration, int healthGain = 0) { Type = effect; LinkedActor = linkedActor; HealthOnRemove = healthGain; RemainingDuration = duration; }
private void UseAbility(BattleActorBase target) { if (target is EnemyBase) { target.DispatchBlockableDamage(this, SelectedAbility.Damage); } Ability a = SelectedAbility; if (a.Applies != Stat.None) { if (a.Applies == Stat.Cure) { target.AddStatusEffect(a.Applies, this, a.Duration, a.Damage); } if (a.Applies == Stat.Focus) { AddStatusEffect(a.Applies, target, a.Duration, a.Damage); } else { target.AddStatusEffect(a.Applies, this, a.Duration, 0); } } }
public virtual void Init(BattleActorBase actor) { owner = actor; transform.SetParent(BattleController.Instance.healthAndDamage.transform); UpdatePosition(); (transform as RectTransform).sizeDelta = Vector2.zero; }
public void CmdHelpWithStat(Stat type, GameObject target) { BattleActorBase t = target.GetComponent <BattleActorBase>(); t.RpcDisplayStat(type, -1); t.RpcDecrementDuration(type, 1); RpcAttack(); }
[Server] //stacks the duration if it is already in the list public void AddStatusEffect(Stat effect, BattleActorBase otherActor, int duration, int healthOnRemove = 0) { if (!battleStats.Immunities.Stats.Any(x => x == effect)) { RemoveOnAdd(effect); RpcAddStatusEffect(effect, otherActor.gameObject, duration, healthOnRemove); } else { RpcDisplayImmunePopup(effect); } }
public override void OnInspectorGUI() { if (GUILayout.Button("Set References")) { BattleActorBase actor = target as BattleActorBase; Animator animator = actor.GetComponent <Animator>(); DamagePopup damagePopup = actor.transform.Find("DamagePopup").GetComponent <DamagePopup>(); HealthBarUI healthBarUI = actor.transform.Find("HealthBarUI").GetComponent <HealthBarUI>(); StatusEffectOverlays overlays = actor.transform.Find("StatusEffectOverlays").GetComponent <StatusEffectOverlays>(); Transform uit = actor.transform.Find("UITransform"); GameObject tempAbilityTarget = actor.transform.Find("TempAbilityTarget").gameObject; actor.SetReferences(animator, damagePopup, healthBarUI, overlays, uit, tempAbilityTarget); } base.OnInspectorGUI(); }
public void DispatchBlockableDamage(List <BattleActorBase> attackers, int damage = 0) { if (HasStatusEffect(Stat.Freeze)) { RpcDecrementDuration(Stat.Freeze, attackers.Count); RpcDisplayStat(Stat.Freeze, 0); } if (HasStatusEffect(Stat.Reflect)) { foreach (BattleActorBase attacker in attackers) { int damageDealt = (damage > 0) ? damage : attacker.AttackDamage; attacker.TakeBlockedDamage(damageDealt); } } else { int sumDamage = 0; if (damage > 0) { sumDamage = damage * attackers.Count; } else { foreach (BattleActorBase attacker in attackers) { sumDamage += attacker.AttackDamage; } } if (HasStatusEffect(Stat.Protected)) { BattleActorBase protector = GetOtherActor(Stat.Protected); protector.TakeBlockedDamage(sumDamage); } else { TakeBlockedDamage(sumDamage); } } }
public override void Init(BattleActorBase actor) { base.Init(actor); SetTargets(); int block = (actor is EnemyBase) ? actor.BattleStats.BlockAmount : 0; if (actor is EnemyBase) { int max = Mathf.Max(actor.BattleStats.BlockAmount, actor.BattleStats.MaxHealth); blockData = new BarData(this, blockBar, null, max, actor.BattleStats.BlockAmount); healthData = new BarData(this, healthBar, healthText, max, actor.BattleStats.MaxHealth); } else { blockData = new BarData(this, blockBar, null, 0, actor.BattleStats.BlockAmount); healthData = new BarData(this, healthBar, healthText, actor.BattleStats.MaxHealth, actor.BattleStats.MaxHealth); } }
protected void CmdUseAbility(GameObject target, int i) { selectedAbilityIndex = i; if (target == null) { if (!SelectedAbility.TargetAll) { OverrideTargeting(); } foreach (BattleActorBase actor in ValidTargets) { UseAbility(actor); } } else { BattleActorBase actor = target.GetComponent <BattleActorBase>(); UseAbility(actor); } OnAbilityUsed(); }
public override void Init(BattleActorBase actor) { base.Init(actor); mainCamera = Camera.main; dotText.transform.position = mainCamera.WorldToScreenPoint(actor.transform.position); }
public void OnAbilityTargetChosen(BattleActorBase target) { CmdUseAbility(target?.gameObject, selectedAbilityIndex); SelectedAbility.Use(); EndAbility(); }
public bool IsValidTarget(BattleActorBase target) { return(ValidTargets.Contains(target)); }