/** * Commit port orders */ void RadarMissileLauncher::execute() { if (reloadtime > 0) { reloadtime--; } //Set boot mem if (stacktaken[0][0]) { bootmem = portstack[0][0]; moveportstack(0); } //Set stack mem if (stacktaken[1][0]) { stackmem = portstack[1][0]; moveportstack(1); } //Fire a missile if (stacktaken[2][0]) { if (reloadtime <= 0) { ourbot->addScreenObject(ourbot->xPos(), ourbot->yPos(), ourbot->direction() + relang, 4, bootmem, stackmem, memd); moveportstack(2); reloadtime = ourlevel; } } }
/** * Commit port orders */ void radarmissilelauncher::execute() { if (reloadtime>0) reloadtime--; //Set boot mem if (stacktaken[0][0] == true) { bootmem = portstack[0][0]; moveportstack (0); } //Set stack mem if (stacktaken[1][0] == true) { stackmem = portstack[1][0]; moveportstack (1); } //Fire a missile if (stacktaken[2][0] == true) { if (reloadtime <= 0) { ourbot->addscrobject (ourbot->getXpos(),ourbot->getYpos(), ourbot->getdir() +relang,4,bootmem,stackmem,memd); moveportstack (2); reloadtime = ourlevel; } } }
/** * Check for port orders */ void engine::execute() { if (stacktaken[0][0] == true) { thrust = portstack[0][0]; if (thrust >ourlevel) thrust = ourlevel; if (thrust <0) thrust =0; moveportstack (0); } if (stacktaken[1][0] == true) { thrust = - (portstack[1][0]); if (thrust < - (ourlevel/2)) thrust = - (ourlevel/2); if (thrust >0) thrust =0; moveportstack (1); } if (thrust >= 0) { ourbot->changeheat (int (thrust/35)); if (thrust > ourbot->getspeed() && ourbot->getfuel() >= thrust+1) { ourbot->changespeed (1); if (thrust > 0) ourbot->setfuel (- (1+thrust/10)); } else { if (ourbot->getspeed() > 0) ourbot->changespeed (-1); if (ourbot->getspeed() < 0) ourbot->changespeed (1); } } if (thrust < 0) { ourbot->changeheat (int (- (thrust/25))); if (thrust < ourbot->getspeed() && ourbot->getfuel() >= (-thrust) +1) { ourbot->changespeed (-1); ourbot->setfuel (- (1+ (-thrust) /10)); } else { if (ourbot->getspeed() < 0) ourbot->changespeed (1); if (ourbot->getspeed() > 0) ourbot->changespeed (-1); } } }
void scandetect::execute() { if (stacktaken[0][0] == true) //Zero scan counter { numscans = 0; moveportstack (0); } }
/** * Check for changes in inports, update timer and * check if time interrupt should be issued */ void timedev::execute() { timecount++; if (stacktaken[0][0] == true) { timecount = portstack[0][0]; moveportstack (0); } if (stacktaken[1][0] == true) { interrupttime = portstack[1][0]; moveportstack (1); } if (stacktaken[2][0] == true) { intenabled = portstack[2][0]; moveportstack (2); } if (timecount == interrupttime && intenabled == true) ourbot->addinterrupt (1); }
void minelayer::execute() { if (stacktaken[0][0] == true) { moveportstack (0); if (minesleft > 0) { ourbot->addscrobject (ourbot->getXpos(),ourbot->getYpos(), ourbot->getdir(),3); minesleft--; } } }
/** * Increases readiness and checks if port orders it * to shoot */ void plasma::execute() { if (readiness < 200) readiness += ourlevel; if (stacktaken[0][0] == true && readiness > 0) { moveportstack (0); //Fire plasma missile code ourbot->addscrobject (ourbot->getXpos(),ourbot->getYpos(), ourbot->getdir() +relang,2,ourbot->getnum()); ourbot->changeheat (45); readiness -= 80; } }
void chiller::execute() { if (ison && ourbot->getfuel() > 5) { ourbot->changeheat (- (heatdiss*2)); ourbot->setfuel (- (5)); } else { ourbot->changeheat (- (heatdiss)); } if (stacktaken[0][0] == true) { ison = portstack[0][0]; moveportstack (0); } }