void HighlightStaffArea(Fighter f, Cell[] range) { Weapon.AttackData data = f.Unit.inventory.GetStaffData(f); if (data == null) { //Debug.LogWarning("Staff not found"); return; } List <Cell> _last = new List <Cell>(); foreach (Cell c in AttackArea) { _last.Add(c); } StaffArea = Map.GetExtendedArea(range, data.range, data.closedSet, data.closedSetMin); if (highlight == null) { highlight = new List <Cell>(); } foreach (Cell c in StaffArea) { if (_last.Contains(c)) { continue; } Highlight(c, "green"); } }
public void Damage(Weapon.AttackData attackData) { m_HitCoolDown = 5f; regenerationsBlock = false; Stats.Damage(attackData); OnDamage?.Invoke(); }
public override void OnAttack(CharacterData target, CharacterData user, ref Weapon.AttackData attackData) { if (Random.value < (PercentageChance / 100.0f)) { ElementalEffect effect = new ElementalEffect(Time, StatSystem.DamageType.Fire, Damage, 1.0f); target.Stats.AddElementalEffect(effect); } }
void GetAtkData() { AtkData = Fighter.Unit.inventory.GetAttackData(Fighter); if (AtkData != null) { foreach (Cell c in Map.GetExtendedArea(MoveArea.ToArray(), AtkData)) { AttackArea.Add(c); } } }
void HighlightAttackArea(Fighter f, Cell[] range) { Weapon.AttackData data = f.Unit.inventory.GetAttackData(f); if (data == null) { //Debug.LogWarning("Weapon not found"); return; } List <Cell> _last = new List <Cell>(); foreach (Cell c in range) { _last.Add(c); } AttackArea = Map.GetExtendedArea(range, data.range, data.closedSet, data.closedSetMin); if (highlight == null) { highlight = new List <Cell>(); } foreach (Cell c in AttackArea) { if (highlight.Contains(c) || _last.Contains(c)) { continue; } Fighter u = c.unitInTile; if (u == null) { Highlight(c, "red"); continue; } if (f.Unit.alignment == u.Unit.alignment) { Highlight(c, "blue"); } else { Highlight(c, "red"); } } }
public void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Enemy")) { CharacterData target = other.gameObject.GetComponent <SimpleEnemyController>().GetCharacterData(); if (target == null) { return; } CharacterData playerData = CharacterControl.Instance.Data; Weapon.AttackData attackData = new Weapon.AttackData(target, playerData); attackData.AddDamage(StatSystem.DamageType.Fire, damage); target.Damage(attackData); } }
private IEnumerator OnSelectedChange() { ClearDrawnPath(); ClearHighlightedArea(); yield return(StartCoroutine(Fighter.ApplyPath(QPath.FindPath(Fighter, startCell, Selected, Cell.EstimateDistance), GameSettings.DoMoveAnimation))); AttackArea = new Cell[0]; StaffArea = new Cell[0]; if (Fighter.Unit.inventory.GetWeapons(Fighter, true).Length > 0) { Weapon.AttackData atkData = Fighter.Unit.inventory.GetAttackData(Fighter); if (atkData != null) { AttackArea = Map.GetExtendedArea(new Cell[] { Map.UnitTile(Fighter) }, atkData.range, atkData.closedSet, atkData.closedSetMin); } } if (Fighter.Unit.inventory.GetStaves(Fighter, true).Length > 0) { Weapon.AttackData stfData = Fighter.Unit.inventory.GetStaffData(Fighter); if (stfData != null) { StaffArea = Map.GetExtendedArea(new Cell[] { Map.UnitTile(Fighter) }, stfData.range, stfData.closedSet, stfData.closedSetMin); } } CurrentRange = new List <Cell> { Map.GetCellData(Fighter.Position()) }; DoHighlights(Fighter, CurrentRange.ToArray(), false); ActionMenu.Open(Fighter); ActionMenu.ActionDone = false; }
public override void OnPostAttack(CharacterData target, CharacterData user, Weapon.AttackData data) { int amount = Mathf.FloorToInt(data.GetDamage(StatSystem.DamageType.Physical) * (PercentageHealthStolen / 100.0f)); user.Stats.ChangeHealth(amount); }
public void Damage(Weapon.AttackData attackData) { int totalDamage = attackData.GetFullDamage(); ChangeHealth(-totalDamage); }
public static Cell[] GetExtendedArea(Cell[] moveArea, Weapon.AttackData data) { return(GetExtendedArea(moveArea, data.range, data.closedSet, data.closedSetMin)); }