def deathbattle(UnitListA,UnitListB,verbose): while len(UnitListA) > 1 and len(UnitListB) > 1: Feartest(UnitListA,UnitListB,verbose) CombatRes = BRB.combatround(UnitListA,UnitListB,verbose) rankbonus1 = 3 if (len(UnitListA) - 1) / UnitListA[0].Width > 3 else (len(UnitListA) - 1) / UnitListA[0].Width rankbonus2 = 3 if (len(UnitListB) - 1) / UnitListB[0].Width > 3 else (len(UnitListB) - 1) / UnitListB[0].Width CombatRes += rankbonus1 - rankbonus2 if CombatRes > 0: if verbose >= 2: print "Army One won that round of combat by %i!" %(CombatRes) if len(UnitListB) > 1 and len(UnitListA) > 1 and len(UnitListB)/UnitListB[0].Width <= len(UnitListA)/UnitListA[0].Width: if BRB.breaktest(UnitListB,CombatRes,verbose) == 0: BRB.runaway(UnitListB,UnitListA,verbose) elif CombatRes < 0: CombatRes = abs(CombatRes) if verbose >= 2: print "Army two won that round of combat by %i!" %(CombatRes) if len(UnitListA) > 1 and len(UnitListB) > 1 and len(UnitListA)/UnitListA[0].Width <= len(UnitListB)/UnitListB[0].Width: if BRB.breaktest(UnitListA,CombatRes,verbose) == 0: BRB.runaway(UnitListA,UnitListB,verbose) else: if verbose >= 2: print "Combat was a tie!" if len(UnitListA) == 1: if verbose >= 1: print "Army Two wins with %i Models Remaining!" %(len(UnitListB)-1) return len(UnitListB)-1 elif len(UnitListB) == 1: if verbose >= 1: print "Army One wins with %i Models Remaining!" %(len(UnitListA)-1) return -(len(UnitListA)-1)
def Feartest(UnitListA, UnitListB, verbose): RemoveFear(UnitListA) RemoveFear(UnitListB) SetFear(UnitListA) SetFear(UnitListB) if FearCheck(UnitListA, UnitListB): if verbose >= 4: print "Army Two must Fear Test!" if BRB.breaktest(UnitListB, 0, verbose): if verbose >= 4: print "Fear Test Passed!" else: BRB.runaway(UnitListB, UnitListA, verbose) if verbose >= 4: print "Fear Test Failed!" if FearCheck(UnitListB, UnitListA): if verbose >= 4: print "Army One must Fear Test!" if BRB.breaktest(UnitListA, 0, verbose): if verbose >= 4: print "Fear Test Passed!" else: BRB.runaway(UnitListA, UnitListB, verbose) if verbose >= 4: print "Fear Test Failed!"
def Feartest(UnitListA,UnitListB,verbose): RemoveFear(UnitListA) RemoveFear(UnitListB) SetFear(UnitListA) SetFear(UnitListB) if FearCheck(UnitListA,UnitListB): if verbose >=4: print "Army Two must Fear Test!" if BRB.breaktest(UnitListB,0,verbose): if verbose >=4: print "Fear Test Passed!" else: BRB.runaway(UnitListB,UnitListA,verbose) if verbose >=4: print "Fear Test Failed!" if FearCheck(UnitListB,UnitListA): if verbose >=4: print "Army One must Fear Test!" if BRB.breaktest(UnitListA,0,verbose): if verbose >=4: print "Fear Test Passed!" else: BRB.runaway(UnitListA,UnitListB,verbose) if verbose >=4: print "Fear Test Failed!"
def deathbattle(UnitListA, UnitListB, verbose): while len(UnitListA) > 1 and len(UnitListB) > 1: Feartest(UnitListA, UnitListB, verbose) CombatRes = BRB.combatround(UnitListA, UnitListB, verbose) rankbonus1 = 3 if (len(UnitListA) - 1) / UnitListA[0].Width > 3 else (len(UnitListA) - 1) / UnitListA[0].Width rankbonus2 = 3 if (len(UnitListB) - 1) / UnitListB[0].Width > 3 else (len(UnitListB) - 1) / UnitListB[0].Width CombatRes += rankbonus1 - rankbonus2 if CombatRes > 0: if verbose >= 2: print "Army One won that round of combat by %i!" % (CombatRes) if ( len(UnitListB) > 1 and len(UnitListA) > 1 and len(UnitListB) / UnitListB[0].Width <= len(UnitListA) / UnitListA[0].Width ): if BRB.breaktest(UnitListB, CombatRes, verbose) == 0: BRB.runaway(UnitListB, UnitListA, verbose) elif CombatRes < 0: CombatRes = abs(CombatRes) if verbose >= 2: print "Army two won that round of combat by %i!" % (CombatRes) if ( len(UnitListA) > 1 and len(UnitListB) > 1 and len(UnitListA) / UnitListA[0].Width <= len(UnitListB) / UnitListB[0].Width ): if BRB.breaktest(UnitListA, CombatRes, verbose) == 0: BRB.runaway(UnitListA, UnitListB, verbose) else: if verbose >= 2: print "Combat was a tie!" if len(UnitListA) == 1: if verbose >= 1: print "Army Two wins with %i Models Remaining!" % (len(UnitListB) - 1) return len(UnitListB) - 1 elif len(UnitListB) == 1: if verbose >= 1: print "Army One wins with %i Models Remaining!" % (len(UnitListA) - 1) return -(len(UnitListA) - 1)