• Check out the relaunch of our general collection, with classic designs and new ones by our very own Pissog!

Status of Pokemon Competitor, Call for Experienced Python Programmers

Broken Promise

The sketch didn't really clear anything up, so I just took a potshot at calculating base-power for simple attacks. Behold!
Code:
apply = self.power
 
if Moves.Helping_Hand in caster.active_monster.conditions:
    apply *= 1.5
 
apply = caster.active_monster.item.attack(caster, apply)
 
if self.type is Types.ELECTRIC:
    if Moves.Charge in caster.active_monster.conditions:
        apply *= 2
    if Moves.Mud_Sport in stage.conditions:
        apply *= 0.5
elif self.type is Types.FIRE:
    if Moves.Water_Sport in stage.conditions:
        apply *= 0.5
 
apply = caster.active_monster.ability.attack(caster, apply)
apply = target.active_monster.ability.attack(target, None, apply)
The above will be in its own function, so that special attacks can also use it. I may be able to trudge ahead, with an ultimate generic command that doesn't even affect gameplay, to get the battle-system realized; and that may be most prudent, considering the admittedly unexpected complexity of damage-calculation within Pokémon. Yes, I will address the use of ‘self’, too.
 
I'm so good that I suck.

I'm really far too rash, sometimes. The following is a translation of the algorithm found within the introductory portion of Smogon's own damage-calculation that I simply skimmed over:
Code:
damage = caster.active_monster.level * 2
damage = damage / 5
damage = damage + 2
damage = damage * Aqua_Tail.power ##
damage = damage * caster.active_monster.attack(Aqua_Tail)
damage = damage / 50
damage = damage / target.active_monster.defend(Aqua_Tail)
# Mod1
damage = damage + 2
damage = damage * critical_hit(caster.active_monster, Aqua_Tail)
# Mod2
damage = damage * random_damage()
damage = damage / 100
damage = damage * caster.active_monster.STAB(Aqua_Tail)
# Type1
# Type2
# Mod3
I've marked the power so that I remember to flesh it out properly. The comments are placeholders for whole functions that I need to structure. Why did I choose Aqua Tail for my sketch? It was the first basic attack on the list of 'em all.
 
Alright. Alfonso, if you are interested in helping to code something, you should contact Colin or bearzly. They are working on the next release of Shoddy Battle. They may or may not appreciate your help if you are expert in the necessary areas.
 
Back
Top