Class Pirate


  • public class Pirate
    extends Component
    Gives the concepts of health plunder, etc. Allows for firing of cannonballs, factions, death, targets
    • Field Detail

      • plunder

        public static int plunder
      • isAlive

        protected boolean isAlive
    • Constructor Detail

      • Pirate

        public Pirate()
    • Method Detail

      • healthUpgrade

        public void healthUpgrade()
        Powerups below added for assessment 2. Applies a powerup to increase the player's health by 20
      • ammoUpgrade

        public void ammoUpgrade()
        Applies a powerup to increase the player's ammo by 5
      • multiShootUpgrade

        public void multiShootUpgrade()
        Applies a powerup to shoot three cannonballs at once
      • speedUpgrade

        public void speedUpgrade()
        Applies a powerup to increase the player ship's speed
      • reduceDamage

        public void reduceDamage()
        Applies a powerup to reduce the damage taken by the player when fired at by enemy ships
      • getActiveUpgrades

        public boolean[] getActiveUpgrades()
      • updateSettings

        public void updateSettings​(int difficulty)
      • addTarget

        public void addTarget​(Ship target)
      • getPlunder

        public int getPlunder()
      • addPlunder

        public void addPlunder​(int money)
      • getFaction

        public Faction getFaction()
      • setFactionId

        public void setFactionId​(int factionId)
      • takeDamage

        public void takeDamage​(float dmg)
      • shoot

        public void shoot​(com.badlogic.gdx.math.Vector2 dir)
        Will shoot a cannonball assigning 'this.parent' as the cannonball's parent (must be Ship atm)
        Parameters:
        dir - the direction to shoot in
      • reload

        public void reload​(int ammo)
        Adds ammo
        Parameters:
        ammo - amount to add
      • getHealth

        public int getHealth()
      • setHealth

        public void setHealth​(int newHealth)
      • canAttack

        public boolean canAttack()
        If distance to target is less than attack range, target will be null if not in agro range.
      • targetPosition

        public com.badlogic.gdx.math.Vector2 targetPosition()
      • isAgro

        public boolean isAgro()
        if dst to target is greater than or equal to attack range target will be null if not in agro range
      • getTarget

        public Ship getTarget()
      • isAlive

        public boolean isAlive()
      • kill

        public void kill()
        Kill itself
      • onDeath

        protected void onDeath()
        Called when an enemy pirate dies. Added for assessment 2: Gain points and plunder.
      • setAmmo

        public void setAmmo​(int ammo)
      • getAmmo

        public int getAmmo()