src/main/java/ru/alphatech/icfpc/cards/Help.java
changeset 68 a84a3c755d93
parent 64 8ce8964b584f
child 74 b277f6c31f5f
     1.1 --- a/src/main/java/ru/alphatech/icfpc/cards/Help.java	Sun Jun 19 14:30:33 2011 +0400
     1.2 +++ b/src/main/java/ru/alphatech/icfpc/cards/Help.java	Sun Jun 19 15:04:59 2011 +0400
     1.3 @@ -24,27 +24,35 @@
     1.4  						{
     1.5  							int i = ((Value)iobj).getValue();
     1.6  							int n = ((Value)nobj).getValue();
     1.7 -							int v = proponent.getSlot(i).getVitality();
     1.8  							
     1.9 -							if(i >= 0 && i <= 255 && n <= v)
    1.10 +							if(i >= 0 && i <= 255)
    1.11  							{
    1.12 -								if(jobj instanceof Value)
    1.13 +								int v = proponent.getSlot(i).getVitality();
    1.14 +								
    1.15 +								if(n <= v)
    1.16  								{
    1.17 -									int j = ((Value)jobj).getValue();
    1.18 -									
    1.19 -									if(j >= 0 && j <= 255)
    1.20 +									if(jobj instanceof Value)
    1.21  									{
    1.22 -										int w = proponent.getSlot(j).getVitality();
    1.23 +										int j = ((Value)jobj).getValue();
    1.24  										
    1.25 -										if(w > 0)
    1.26 +										if(j >= 0 && j <= 255)
    1.27  										{
    1.28 -											int winc = (int) Math.floor(11 * n / 10);
    1.29 -											int resw = w + winc;
    1.30 +											int w = proponent.getSlot(j).getVitality();
    1.31  											
    1.32 -											proponent.getSlot(j).setVitality(resw > 65535 ? 65535 : resw);
    1.33 +											if(w > 0)
    1.34 +											{
    1.35 +												int winc = (int) Math.floor(11 * n / 10);
    1.36 +												int resw = w + winc;
    1.37 +												
    1.38 +												proponent.getSlot(j).setVitality(resw > 65535 ? 65535 : resw);
    1.39 +											}
    1.40 +											
    1.41 +											return new I();
    1.42  										}
    1.43 -										
    1.44 -										return new I();
    1.45 +										else
    1.46 +										{
    1.47 +											throw new ICFPCException();
    1.48 +										}
    1.49  									}
    1.50  									else
    1.51  									{