Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- #first gather information about the attacking and defending pokemon
- L = input("Attacking Pokemon's level: ")
- A = input("Attacking Pokemon's offensive stat value: ")
- P = input("Attacking move's base power: ")
- D = input("Defending Pokemon's defensive stat value: ")
- HP = input("Defending Pokemon's HP value: ")
- xitem = input("Attack stage after boosts/drops: ")
- defstage = input("Defense stage after boosts/drops: ")
- badgeboost = raw_input("Does a badge boost apply? y or n: ")
- softwater = raw_input("Does a mystic water or soft sand boost apply? y or n: ")
- torrentcheck = raw_input("Does Torrent apply? y or n: ")
- doublecheck = raw_input("Does the attack target both defending Pokemon? y or n: ")
- stabcheck = raw_input("Is the move STAB? y or n: ")
- weathercheck = raw_input("Is the move boosted by weather? y or n: ")
- typeeffect = input("What is the type-effectiveness? 0.25, 0.5, 1, 2, or 4: ")
- critcheck = raw_input("Is the move a critical hit? y or n: ")
- lsrefcheck = raw_input("Is light screen or reflect active? y or n: ")
- #next modify the attack stat based on the answers to the above
- #but adjust stat stage if critical hit
- if critcheck == "y" and xitem < 0:
- xitem = 0
- elif critcheck == "n":
- xitem = xitem
- if critcheck == "y" and defstage > 0:
- defstage = 0
- elif critcheck == "n":
- defstage = defstage
- if badgeboost == "y":
- A = int(A*1.1)
- elif badgeboost == "n":
- A = A
- if softwater == "y":
- A = int(A*1.1)
- elif softwater == "n":
- A = A
- if xitem == 0:
- A = A
- elif xitem == -1:
- A = int(A*10/15)
- elif xitem == -2:
- A = int(A*10/20)
- elif xitem == -3:
- A = int(A*10/25)
- elif xitem == -4:
- A = int(A*10/30)
- elif xitem == -5:
- A = int(A*10/35)
- elif xitem == -6:
- A = int(A*10/40)
- elif xitem == 1:
- A = int(A*15/10)
- elif xitem == 2:
- A = int(A*20/10)
- elif xitem == 3:
- A = int(A*25/10)
- elif xitem == 4:
- A = int(A*30/10)
- elif xitem == 5:
- A = int(A*35/10)
- elif xitem == 6:
- A = int(A*40/10)
- if defstage == 0:
- D = D
- elif defstage == -1:
- D = int(D*10/15)
- elif defstage == -2:
- D = int(D*10/20)
- elif defstage == -3:
- D = int(D*10/25)
- elif defstage == -4:
- D = int(D*10/30)
- elif defstage == -5:
- D = int(D*10/35)
- elif defstage == -6:
- D = int(D*10/40)
- elif defstage == 1:
- D = int(D*15/10)
- elif defstage == 2:
- D = int(D*20/10)
- elif defstage == 3:
- D = int(D*25/10)
- elif defstage == 4:
- D = int(D*30/10)
- elif defstage == 5:
- D = int(D*35/10)
- elif defstage == 6:
- D = int(D*40/10)
- if torrentcheck == "y":
- P = int(P*1.5)
- elif torrentcheck == "n":
- P = P
- #third calculate the base damage of the attack before a few additional modifiers
- basedamage = int(int(int(2*L/5+2)*A*P/D)/50)
- #then include the relevant modifiers
- if lsrefcheck == "y" and doublecheck == "n":
- basedamage = int(basedamage/2)
- elif lsrefcheck == "y" and doublecheck == "y":
- basedamage = int((basedamage*2)/3)
- elif lsrefcheck == "n" and doublecheck == "n":
- basedamage = basedamage
- if doublecheck == "y":
- basedamage = int(basedamage/2)
- elif doublecheck == "n":
- basedamage = basedamage
- if weathercheck == "y":
- basedamage = int(basedamage*1.5)
- elif weathercheck == "n":
- basedamage = basedamage
- basedamage += 2
- #multiply by 2 for critical
- if critcheck == "y":
- basedamage *= 2
- elif critcheck == "n":
- basedamage = basedamage
- #factor in STAB
- if stabcheck == "y":
- basedamage = int(basedamage*1.5)
- elif stabcheck == "n":
- basedamage = basedamage
- #then type-effectiveness
- damage = int(basedamage * typeeffect)
- #finally factor in damage variance and print
- R = range(85,101)
- missedrange = 0
- for i in R:
- roll = int((damage*i)/100)
- if HP - roll > 0:
- missedrange += 1
- OHKO = 100 * ((16 - missedrange)/float(16))
- minroll = int((damage*85)/100)
- print("{}-{} damage".format(minroll, damage))
- print("{}% chance to OHKO".format(OHKO))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement