User:Alexanderpas/Packages/AgressiveCounterAttack
From Hack Wars Wiki
Contents |
Watch
suggested to place this watch on the bank and the default attack port.
Code
Fire
int main(){
}
Attack (Default Port)
Code
Initialize
int main() {
- // Nothing special.
}
Finalize
int main() {
- // Nothing special.
}
Continue
int main() {
- if (portHealth() < 10) {
- // port HP: 00-09
- // CPU load: 00-99
- cancelAttack();
- } else if (CPUload() < 85) {
- // port HP: 10-100
- // CPU load: 00-84
- berserk();
- } else if (portHealth() == 100) {
- // port HP: 100
- // CPU load: 85-99
- regularAttack();
- } else if (CPUload() > 95) {
- // port HP: 10-99
- // CPU load: 95-99
- cancelAttack();
- } else {
- // port HP: 10-99
- // CPU load: 85-94
- freeze();
- }
}
int CPUload() {
- float value = (getCPULoad() / getMaximumCPULoad());
- return intValue(100 * value);
}
int portHealth() {
- return intValue(getHP());
}
void regularAttack() {
- // Nothing special.
}
