//#---------------------------------------------------------- //# * Initialize //#---------------------------------------------------------- public Effect_Missile(Game_BattleUnit unit, Point2DEx srcGridPt, Point2DEx startPt, int maxTick) : base(maxTick) { _bitmapName = unit.MissileBitmapName(); _playerSide = unit.IsPlayerOwned; DamageAgent = unit.GetDamageAgent(); _srcGridPt = srcGridPt; _startPt = startPt; }
//#---------------------------------------------------------- //# * Initialize //#---------------------------------------------------------- public Game_DamageAgent(Game_BattleUnit unit) { IsPlayer = unit.IsPlayerOwned; UnitClass = unit.Class; Damage = unit.Attack; ExtraDamage = unit.ExtraDamage; BitmapHit = unit.MissileHitBitmapName(); SoundHit = unit.SoundHit; }
//#---------------------------------------------------------- //# * Initialize //#---------------------------------------------------------- public Effect_Projectile(Game_BattleUnit unit, Point2DEx srcPt, Point2DEx startPt, int range) : base(unit, srcPt, startPt, range * 5) { _splash = unit.HasSplashSkill(); _range = Math.Abs(range); }
//#---------------------------------------------------------- //# * Initialize //#---------------------------------------------------------- public Effect_Magic(Game_BattleUnit unit, Point2DEx srcPt, Point2DEx startPt) : base(unit, srcPt, startPt, 10) { }
//#---------------------------------------------------------- //# * Is Legal Move //#---------------------------------------------------------- private bool IsLegalMove(Game_BattleUnit unit, Point2DEx srcPt, ref List<Point2DEx> checkedPts) { checkedPts.Add(srcPt); Point2DEx destPt = srcPt.Add(unit.MoveVector()); if (!unit.IsReadyToStartAct(Game_UnitAction.Move)) return false; // check if unit is ready to move if (IsOnOpponentZone(unit, destPt)) return false; // if destination moves into reinforcement zone, return // if occupied, check conditions when move is still possible (dead unit or grouped unit that would move together) Game_BattleUnit destUnit = _units[destPt.X, destPt.Y]; if (destUnit != null) { if (destUnit.IsAlly(unit)) { // if moving pt is grouped unit if (!(unit.IsPlayerOwned ? unit.RightConnected : unit.LeftConnected)) return false; } else { // units can move over dead enemy units if (!destUnit.IsDead()) return false; } } // check group's ability to move List<Point2DEx> AdjPts = GetAdjacentPts(srcPt.X, srcPt.Y); for (int i = 0; i < 4; i++) { Point2DEx direction = AdjPts[i]; if (!checkedPts.Contains(direction)) { if (unit.Connections[i] && !IsLegalMove(_units[direction.X, direction.Y], direction, ref checkedPts)) return false; } } return true; }
public Game_BattleUnit CreateBattleUnit(int x, int y) { Game_BattleUnit unit = new Game_BattleUnit(Global.Units[UnitIDs[x, y]], this, IsPlayerOwned, IsVeteran); List<Point2DEx> AdjPts = GetAdjacentPts(x, y); for (int i = 0; i < 4; i++) if (IsOccupiedPt(AdjPts[i].X, AdjPts[i].Y)) unit.Connections[i] = true; return unit; }