internal Projectile(Moveable owner, Vector2f start, Moveable d, Func<Moveable, bool> doA, Texture texture, IntRect rect, float scale) { currentLoc = start; dest = d; doAbility = doA; currentTexture = texture; currentTextureRect = rect; collide = false; this.owner = owner; this.scale = scale; xNeeded = d.getMid().X - start.X; yNeeded = d.getMid().Y - start.Y; mid = new Vector2f(rect.Width / 2, rect.Height / 2); scale = 1.0f; currentSprite = new Sprite(currentTexture); currentSprite.Scale = new Vector2f(scale, scale); currentSprite.Position = start; currentSprite.Origin = mid; }
internal bool doSpawnAdds(Moveable mob) { InGame.getInstance().addMoveable(new BasicAdd(new Vector2f(mob.getMid().X - 10,mob.getMid().Y),mob,this)); InGame.getInstance().addMoveable(new BasicAdd(new Vector2f(mob.getMid().X + 10,mob.getMid().Y),mob,this)); changeAddAmt(2); return false; }
protected static double getDistance(Moveable ursidor, Moveable fish) { return InGame.getDistance(ursidor.getMid(), fish.getMid()); }
internal bool checkDestCircleRange(Moveable mob, int range) { return InGame.areCircleswithRange(getDestMid(), getInnerRadius(), mob.getMid(), mob.getInnerRadius(), range); }
internal bool checkCircleRangeAndMove(Moveable mob, int range, double gameTime) { bool aBool; if (aBool = (!InGame.areCircleswithRange(getMid(),getInnerRadius(), mob.getMid(),mob.getInnerRadius(), range))) { sendPlayerInCircleRangeOf( mob.getMid(), mob.getInnerRadius(), range, gameTime); } return aBool; }
//TODO keep active list of this internal List<PlayerClassI> getLowestHPplayers(int amt, Moveable caster, int range) { if(amt != 2) throw new Exception(); List<PlayerClassI> l = new List<PlayerClassI>(); l.Add(null); l.Add(null); foreach (PlayerClassI mob in getAlivePlayerMoveables()) { if(areCircleswithRange(mob.getMid(),mob.getInnerRadius(),caster.getMid(),caster.getInnerRadius(),range)){ if ((l[0] == null || l[0].getHPpercent() > mob.getHPpercent())) { l[1] = l[0]; l[0] = mob; } else if ((l[1] == null || l[1].getHPpercent() > mob.getHPpercent())) { l[1] = mob; } } } return l; }
//gets in circle range? internal List<Moveable> getAliveEnemyMoveables(Moveable me, int range) { List<Moveable> l = new List<Moveable>(); foreach (Moveable m in moveables) { if (m is Enemy && !m.isDead() && areCircleswithRange(me.getMid(), me.getInnerRadius(),m.getMid(), m.getInnerRadius(), range)) l.Add(m); } return l; }
internal static bool areCircleswithRange(Moveable m1, Moveable m2, int range) { return areCircleswithRange(m1.getMid(), m1.getInnerRadius(), m2.getMid(), m2.getInnerRadius(), range); }
//damagee = person who gets damaged internal bool doFireball(Moveable damagee) { damagee.takeDamage(this, FIREBALL_DMG); if (InGame.randy.NextDouble() <= BIGFIREBALL_STACK_CHANCE) sb1.stack(1); //aoe List<Moveable> enemys = InGame.getInstance().getAliveEnemyMoveables(damagee, FIREBALL_AOE_RANGE); foreach (Moveable mob in enemys) { if (!mob.isDead() && mob != damagee) { InGame.getInstance().addProjectileFromProj(new Projectile(this, damagee.getMid(), mob, doFireballAoe, fireballAoeProjectileTexture, fireballAoeProjectileRect)); } } return true; }
internal bool doBigFireball(Moveable damagee) { damagee.takeDamage(this, BIGFIREBALL_DMG); //aoe List<Moveable> enemys = InGame.getInstance().getAliveEnemyMoveables(damagee, BIGFIREBALL_AOE_RANGE); foreach (Moveable mob in enemys) { if (!mob.isDead() && mob != damagee) InGame.getInstance().addProjectileFromProj(new Projectile(this, damagee.getMid(), mob, doBigFireballAoe, bigFireballAoeProjectileTexture,bigFireballAoeProjectileRect)); } return true; }