src/main/java/ru/alphatech/icfpc/cards/Inc.java
changeset 88 9555608af847
parent 79 0bfd181c663e
child 102 cc814352ab43
equal deleted inserted replaced
87:0f4c762f56f7 88:9555608af847
     1 package ru.alphatech.icfpc.cards;
     1 package ru.alphatech.icfpc.cards;
     2 
     2 
     3 import ru.alphatech.icfpc.game.ICFPCException;
     3 import ru.alphatech.icfpc.game.ICFPCException;
     4 import ru.alphatech.icfpc.game.IValue;
     4 import ru.alphatech.icfpc.game.IValue;
     5 import ru.alphatech.icfpc.game.Player;
     5 import ru.alphatech.icfpc.game.Player;
       
     6 import ru.alphatech.icfpc.game.Run;
     6 import ru.alphatech.icfpc.game.Value;
     7 import ru.alphatech.icfpc.game.Value;
     7 
     8 
     8 public class Inc implements ICard
     9 public class Inc implements ICard
     9 {
    10 {
       
    11 	@Override
       
    12 	public String getName() {
       
    13 		return "inc";
       
    14 	}
       
    15 	
    10 	@Override
    16 	@Override
    11 	public IValue returnValue(IValue iobj, Player proponent, Player opponent)
    17 	public IValue returnValue(IValue iobj, Player proponent, Player opponent)
    12 	{
    18 	{
    13 		if(iobj instanceof Value)
    19 		if(iobj instanceof Value)
    14 		{
    20 		{
    16 
    22 
    17 			if (i >= 0 && i <= 255)
    23 			if (i >= 0 && i <= 255)
    18 			{
    24 			{
    19 				int v = proponent.getSlot(i).getVitality();
    25 				int v = proponent.getSlot(i).getVitality();
    20 				
    26 				
    21 				if (v > 0 && v < 65535)
    27 				if(Run.getAutoMode())
    22 				{
    28 				{
    23 					proponent.getSlot(i).setVitality(v + 1);
    29 					if(v > 0)
       
    30 					{
       
    31 						proponent.getSlot(i).setVitality(v - 1);
       
    32 					}
       
    33 				}
       
    34 				else
       
    35 				{
       
    36 					if (v > 0 && v < 65535)
       
    37 					{
       
    38 						proponent.getSlot(i).setVitality(v + 1);
       
    39 					}
    24 				}
    40 				}
    25 				
    41 				
    26 				return new I();
    42 				return new I();
    27 			}
    43 			}
    28 			else
    44 			else