- Timestamp:
- Dec 2, 2018, 10:47:00 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
r12133 r12134 1 2 3 4 1 5 2 … … 64 61 if (checkMove(SET_TROOPS_INITIAL)){ 65 62 this->target_province->owner_ID = this->Player_ID; 66 this->target_province-> troops += 1;67 orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province-> troops<<endl;63 this->target_province->setTroops(this->target_province->getTroops()+1); 64 orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->getTroops()<<endl; 68 65 master->playerFinishedStageCallback(this); 69 66 }else{ … … 77 74 { 78 75 if (checkMove(SET_TROOPS)){ 79 this->target_province-> troops += 1;80 orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province-> troops<<endl;76 this->target_province->setTroops(this->target_province->getTroops()+1); 77 orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->getTroops()<<endl; 81 78 } 82 79 … … 87 84 if (checkMove(ATTACK)) 88 85 { 89 while ((this->origin_province-> troops > 1) && (this->target_province->troops> 0)) //still troops available86 while ((this->origin_province->getTroops() > 1) && (this->target_province->getTroops() > 0)) //still troops available 90 87 { 91 while ((this->origin_province-> troops >= 4) && (this->target_province->troops>= 2))88 while ((this->origin_province->getTroops() >= 4) && (this->target_province->getTroops() >= 2)) 92 89 { 93 90 //normal fight, 3 attackers, 2 defenders 94 91 } 95 92 96 if ((this->origin_province-> troops == 3) && (this->target_province->troops>= 2))93 if ((this->origin_province->getTroops() == 3) && (this->target_province->getTroops() >= 2)) 97 94 { 98 95 //2 attackers, 2 defenders 99 96 } 100 97 101 if((this->origin_province-> troops == 2) && (this->target_province->troops>= 2))98 if((this->origin_province->getTroops() == 2) && (this->target_province->getTroops() >= 2)) 102 99 { 103 100 //1 attacker, 2 defenders … … 107 104 } 108 105 109 if (this->target_province-> troops== 0) //attacker won106 if (this->target_province->getTroops() == 0) //attacker won 110 107 { 111 108 this->target_province->owner_ID = this->Player_ID; 112 this->target_province-> troops = (this->origin_province->troops- 1);113 this->origin_province-> troops = 1;109 this->target_province->setTroops(this->origin_province->getTroops() - 1); 110 this->origin_province->setTroops(1); 114 111 } 115 112 } … … 121 118 if (checkMove(MOVE)) 122 119 { 123 this->target_province-> troops += ((this->origin_province->troops) -1);124 this->origin_province-> troops = 1;120 this->target_province->setTroops(this->origin_province->getTroops()-1); 121 this->origin_province->setTroops(1); 125 122 } 126 123 break;
Note: See TracChangeset
for help on using the changeset viewer.