public List<Position> InRangeTiles(BattleEntity self, Direction dir, BattleArena arena) { var result = new List<Position>(); for (int x = 0; x < arena.ArenaSize; x++) { for (int y = 0; y < arena.ArenaSize; y++) { Position target = new Position(x, y); if (dir == Direction.None) { if (InRange(arena, self, target)) { result.Add(target); } } else { if (InRange(arena, self, target, dir)) { result.Add(target); } } } } return result; }
public override bool InRange(BattleArena arena, BattleEntity self, Position target, Direction dir) { var origin = self.CurrentPos; var dist = Math.Abs(origin.X - target.X) + Math.Abs(origin.Y - target.Y); if (dist <= Dist && dist != 0) { return true; } return false; }
public override bool InRange(BattleArena arena, BattleEntity self, Position target) { foreach (Direction dir in Enum.GetValues(typeof(Direction))) { if (InRange(arena, self, target, dir)) { return true; } } return false; }
public override bool InRange(BattleArena arena, BattleEntity self, Position target, Direction dir) { var origin = self.CurrentPos; switch (dir) { case Direction.Up: return target.X == origin.X && target.Y > origin.Y && target.Y - Dist <= origin.Y; case Direction.Right: return target.Y == origin.Y && target.X > origin.X && target.X - Dist <= origin.X; case Direction.Down: return target.X == origin.X && target.Y < origin.Y && target.Y + Dist >= origin.Y; case Direction.Left: return target.Y == origin.Y && target.X < origin.X && target.X + Dist >= origin.X; default: return false; } }
public override void apply(BattleEntity self, BattleEntity target, Direction dir, BattleArena arena) { var lvl = self.Level; var atk = self.Atk; //gérer spe var def = target.Def; //gérer spe double damage = 2; damage *= (2d * lvl + 10d) / 250d; damage *= atk / def; damage *= Value; damage *= 0.85 + rnd.NextDouble() * 15 / 100; //random //gérer stab, crit, type, etc int damageInt = (int)Math.Floor(damage); target.HP -= damageInt; if (target.HP < 0) { target.HP = 0; } }
/* ============================================================================ Initialize functions ============================================================================ */ void Start() { bool destroy = DataHolder.BattleSystem().IsRealTime(); if(this.arenaObject == null || this.collider == null) destroy = true; else this.battleArena = this.arenaObject.GetComponent<BattleArena>(); if(this.battleArena == null) destroy = true; if(destroy) GameObject.Destroy(this.gameObject); else { this.gameObject.layer = 2; this.battleArena.deactivateAfter = false; } }
public void apply(BattleEntity self, Position target, BattleArena arena) { apply(self, target, Direction.None, arena); }
public abstract void apply(BattleEntity self, Position target, Direction dir, BattleArena arena);
public override void apply(BattleEntity self, BattleEntity target, Direction dir, BattleArena arena) { //todo }
public override void apply(BattleEntity self, BattleEntity target, Direction dir, BattleArena arena) { Position newPos = new Position(target.CurrentPos.X + PositionUtils.GetDirPosition(dir).X * Dist, target.CurrentPos.Y + PositionUtils.GetDirPosition(dir).Y * Dist); newPos.NormalizePos(arena.ArenaSize); arena.MoveBattleEntity(target, newPos); }
public virtual bool InRange(BattleArena arena, BattleEntity self, Position target) { return InRange(arena, self, target, Direction.None); }
public abstract bool InRange(BattleArena arena, BattleEntity self, Position target, Direction dir);
public override void apply(BattleEntity self, Position target, Direction dir, BattleArena arena) { arena.MoveBattleEntity(self, target); }
public override bool InRange(BattleArena arena, BattleEntity self, Position target, Direction dir) { return true; }