Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. package sonc.battle;
  2. import java.awt.Color;
  3.  
  4.  
  5. public class Bullet extends Munition{
  6.  
  7. int fireDelay;
  8. int damage;
  9. int impactDamage;
  10. int size;
  11. static double inicialSpeed;
  12. double maxRotation;
  13. double maxSpeed;
  14. double maxSpeedChange;
  15. public static Color color;
  16.  
  17.  
  18. /*FALTA Bullet
  19. public Bullet(double heading)
  20. Create a bullet with a certain heading. The initial position with be that of the ship that fires the missile.
  21. Parameters:
  22. heading - of the bullet
  23. */
  24.  
  25. /**
  26. * @param fireDelay
  27. * @param damage
  28. * @param impactDamage
  29. * @param size
  30. * @param maxRotation
  31. * @param maxSpeed
  32. * @param maxSpeedChange
  33. */
  34. public Bullet(int fireDelay, int damage, int impactDamage, int size, double maxRotation, double maxSpeed,
  35. double maxSpeedChange) {
  36. super();
  37. this.fireDelay = fireDelay;
  38. this.damage = damage;
  39. this.impactDamage = impactDamage;
  40. this.size = size;
  41. this.maxRotation = maxRotation;
  42. this.maxSpeed = maxSpeed;
  43. this.maxSpeedChange = maxSpeedChange;
  44. }
  45.  
  46.  
  47. /**
  48. * Get the delay for firing this king of munition.
  49. * @return delay in number of rounds
  50. */
  51. public int getFireDelay() {
  52. return fireDelay;
  53. }
  54.  
  55.  
  56. /**
  57. * @param fireDelay
  58. * Set the delay for firing this king of munition. This method should be invoked before any battle.
  59. */
  60. public void setFireDelay(int fireDelay) {
  61. this.fireDelay = fireDelay;
  62. }
  63.  
  64. /**
  65. * Get the damage inflicted by a guided missile in the status of ship it hits.
  66. * @return damage inflicted by a guided missile
  67. */
  68. public int getDamage() {
  69. return damage;
  70. }
  71.  
  72.  
  73. /**
  74. * @param damage
  75. * Set the damage inflicted by a bullet in the status of ship it hits. This method should be invoked before any battle.
  76. */
  77. public void setDamage(int damage) {
  78. this.damage = damage;
  79. }
  80.  
  81.  
  82. /**
  83. * Damage inflicted by this moving object when it hits another
  84. * @return amount of status removed from another moving object on collision
  85. */
  86. public int getImpactDamage() {
  87. return impactDamage;
  88. }
  89.  
  90. /**
  91. * Size of this moving object when displayed. Moving objects are represented as elongated objects (imagine a cigar) with this size
  92. * @return size of this moving object
  93. */
  94.  
  95. public int getSize() {
  96. return size;
  97. }
  98.  
  99. /**
  100. * Get the initial speed of a guided missile.
  101. * @return speed of a guided missile
  102. */
  103. public static double getInicialSpeed() {
  104. return inicialSpeed;
  105. }
  106.  
  107. /**
  108. * Set the initial speed of a guided missile. This method should be invoked before any battle.
  109. * @param inicialSpeed
  110. */
  111. public static void setInicialSpeed(double inicialSpeed) {
  112. Bullet.inicialSpeed = inicialSpeed;
  113. }
  114.  
  115. /**
  116. *The maximum rotation per turn of this moving object
  117. * @return maximum rotation
  118. */
  119. public double getMaxRotation() {
  120. @Override
  121. return maxRotation;
  122. }
  123.  
  124. /**
  125. * The maximum speed of this moving object in absolute value. Ships may have negative speed when sailing backwards but the absolute value of the sped cannot exceed this value.
  126. * @return maximum speed variation
  127. */
  128. public double getMaxSpeed() {
  129. return maxSpeed;
  130. }
  131.  
  132. /**
  133. * The maximum speed variation in absolute value, per turn, of this moving object
  134. * @return maximum speed variation
  135. */
  136. public double getMaxSpeedChange() {
  137. @Overrides
  138. return maxSpeedChange;
  139. }
  140. /**
  141. *
  142. Color of this moving objects. Different ships may have their own color but most other have colors depending on their type. Colors may be set as an HTML/CSS color (e.g. "#0000FF") or a name for some basic colors (e.g. "yellow" or "red").
  143. * @return color as a HTML/CSS string or basic color
  144. */
  145. public static Color getColor() {
  146. return color;
  147. }
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement