adamleesaintfrancis / spacewar

Automatically exported from code.google.com/p/spacewar
0 stars 0 forks source link

Shield does not protect against mines or bullets #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a client that does nothing but activate its shield.
2. Shoot it with the human client.
3. The Shield client takes damage from the bullets.

What is the expected output? What do you see instead?
The shield should protect against bullets and mines.  Instead it only
protects against collisions.

What version of the product are you using? On what operating system?
Revision 182.  Ubuntu 8.04 beta.

Please provide any additional information below.

For collisions, the state of the shield is checked in the takeDamage(final
Vector2D deltaVelocity) method of edu.ou.spacewar.objects.Ship.
However, this check cannot simply be added to takeDamage(int) because that
method is called the ship loses energy from taking an action.

Instead, the check should go into the takeShot() method.  It should be
changed to the following:

public final void takeShot() 
{
     if(sheildDelay > 0)
          return;

     this.takeDamage(SHOT_COST);
}

Also, please cc: jfager on any new issues that are opened!  Thank you!

Original issue reported on code.google.com by ztidw...@gmail.com on 31 Mar 2008 at 3:30

GoogleCodeExporter commented 9 years ago
Nevermind.  It looks like this was fixed in the last commit.  I should have 
updated
first.  Sorry.

Original comment by ztidw...@gmail.com on 31 Mar 2008 at 7:15

GoogleCodeExporter commented 9 years ago

Original comment by jfa...@gmail.com on 31 Mar 2008 at 9:30