22 |
22 |
23 private int donorSlotIndex = -1; |
23 private int donorSlotIndex = -1; |
24 private int targetSlotIndex = -1; |
24 private int targetSlotIndex = -1; |
25 private int pointsSlotIndex = -1; |
25 private int pointsSlotIndex = -1; |
26 private int processingSlotIndex = -1; |
26 private int processingSlotIndex = -1; |
|
27 private boolean execute = false; |
27 |
28 |
28 private TYPE type; |
29 private TYPE type; |
29 |
30 |
30 public enum TYPE { |
31 public enum TYPE { |
31 ATTACK, |
32 ATTACK, |
32 HELP |
33 HELP |
33 } |
34 } |
34 |
35 |
35 /** |
36 /** |
36 * |
37 * @param type - ATTACK or HELP |
37 * @param processingSlot - в какой ячейке проводить |
38 * @param processingSlot - в какой ячейке проводить |
38 * @param donor - от кого забирать хп |
39 * @param donor - от кого забирать хп |
39 * @param target - слот который надо атаковать |
40 * @param target - слот который надо атаковать |
40 * @param points - количество хп отнимаемое у донора |
41 * @param points - количество хп отнимаемое у донора |
|
42 * @param execute - выполнить после завершения либо просто сохранить в слоте. |
41 */ |
43 */ |
42 public AttackHelpPolicy(TYPE type, int processingSlot, int donor, int target, int points) { |
44 public AttackHelpPolicy(TYPE type, int processingSlot, int donor, int target, int points, boolean execute) { |
43 this.donorSlotIndex = donor; |
45 this.donorSlotIndex = donor; |
44 this.targetSlotIndex = target; |
46 this.targetSlotIndex = target; |
45 this.pointsSlotIndex = points; |
47 this.pointsSlotIndex = points; |
46 this.processingSlotIndex = processingSlot; |
48 this.processingSlotIndex = processingSlot; |
|
49 this.execute = execute; |
47 |
50 |
48 this.type = type; |
51 this.type = type; |
49 } |
52 } |
50 |
53 |
51 @Override |
54 @Override |
52 public ArrayList<Batch> getBatches() { |
55 public ArrayList<Batch> getBatches() { |
53 ArrayList<Batch> retArray = new ArrayList<Batch>(); |
56 ArrayList<Batch> retArray = new ArrayList<Batch>(); |
54 |
57 |
55 Slot processingSlot = Run.getProponent().getSlot(processingSlotIndex); |
58 Slot processingSlot = Run.getProponent().getSlot(processingSlotIndex); |
56 |
59 |
57 numberIntoSlotField(Run.getRegisterByIndex(0), donorSlotIndex); |
60 retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(0), donorSlotIndex)); |
58 numberIntoSlotField(Run.getRegisterByIndex(1), targetSlotIndex); |
61 retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(1), targetSlotIndex)); |
59 numberIntoSlotField(Run.getRegisterByIndex(2), pointsSlotIndex); |
62 retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(2), pointsSlotIndex)); |
60 |
63 |
61 retArray.addAll(BcombineForFunctWith3ParamsInRegister(getCard(), processingSlot)); |
64 retArray.addAll(BcombineForFunctWith3ParamsInRegister(getCard(), processingSlot)); |
62 |
65 |
63 return retArray; |
66 return retArray; |
64 } |
67 } |
80 |
83 |
81 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
84 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
82 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
85 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
83 |
86 |
84 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Get(), processingSlot)); |
87 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Get(), processingSlot)); |
85 |
|
86 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
|
87 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
|
88 |
88 |
89 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot)); |
89 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot)); |
90 |
90 |
91 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
91 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
92 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
92 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
95 |
95 |
96 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
96 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
97 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
97 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
98 |
98 |
99 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Succ(), processingSlot)); |
99 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Succ(), processingSlot)); |
100 |
|
101 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
|
102 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
|
103 |
100 |
104 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot)); |
101 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot)); |
105 |
102 |
106 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
103 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
107 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
104 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
116 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
113 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
117 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
114 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
118 |
115 |
119 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Succ(), processingSlot)); |
116 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Succ(), processingSlot)); |
120 |
117 |
121 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); |
118 if(execute) |
122 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); |
119 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot)); |
123 |
|
124 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot)); |
|
125 |
120 |
126 return retArray; |
121 return retArray; |
127 } |
122 } |
128 |
123 |
129 |
124 |