コード例 #1
0
  public void aStarDamaged(double damage) {
    // can have a multiplier here to reduce health damage due to spells or armor
    if (armor > 0 & protectSpell > 0) {
      health -= (damage - (damage / armor) - (damage / protectSpell));
    } else health -= damage;

    if (isDead()) {
      Sound.SoundEffect.FEMALE_DEAD.play();
      level.getClientPlayer().xp += Experience.calculateXPFromMob(this);
      level.getClientPlayer().totalXP += Experience.calculateXPFromMob(this);
      level.add(new ParticleSpawner((int) x, (int) y, 44, 50, level, 0xffc40000));
      remove();
    }
  }
コード例 #2
0
  public AStar(int x, int y, int rank, Classification classification) {
    this.x = x << 4;
    this.y = y << 4;
    this.rank = rank;
    this.classification = classification;
    sprite = animSprite.getSprite();
    hitbox = new MobHitbox(Sprite.hitbox21x32);
    inventory = new Inventory();
    healthBar0 = new MobHealthBar((int) this.x - 10, (int) this.y - 20, Sprite.healthBar0);
    healthBar25 = new MobHealthBar((int) this.x - 5, (int) this.y - 20, Sprite.healthBar25);
    healthBar50 = new MobHealthBar((int) this.x, (int) this.y - 20, Sprite.healthBar50);
    healthBar75 = new MobHealthBar((int) this.x + 5, (int) this.y - 20, Sprite.healthBar75);

    // Shooter default attributes
    maxHealth = Experience.calculateMobHealth(this, 100);
    health = maxHealth;
    maxMana = Experience.calculateMobMana(this, 100);
    mana = maxMana;
    armor = Experience.calculateMobArmor(this, 0);
    protectSpell = 0.0;
  }