- 91
- Posts
- 14
- Years
- Seen Sep 5, 2015
Last edited:
class PokeBattle_Move_169 < PokeBattle_Move
def pbIsPhysical?(type,attacker)
if @battle.field.effects[PBEffects::WonderRoom]>0
return attacker.spatk>=attacker.attack
else
return attacker.attack>attacker.spatk
end
end
def pbIsSpecial?(type,attacker)
if @battle.field.effects[PBEffects::WonderRoom]>0
return attacker.attack>attacker.spatk
else
return attacker.spatk>=attacker.attack
end
end
end
This is my PokeBattle_Move. http://pastebin.com/DPqbnR5y And this is after editing "def pbIsPhysical?(type,attacker=nil) and Special. http://pastebin.com/83VJksyP
Problem is, the move is not doing damage. I changed the function code in the PBS Moves file in Hidden Power to my new function, but I feel it's lacking something such as
"def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)"
because it's also not doing its animation.
Thank you very much for your help.
################################################################################
# Power and type depends on the user's IVs.
################################################################################
class PokeBattle_Move_090 < PokeBattle_Move
def pbType(type,attacker,opponent)
hp=pbHiddenPower(attacker.iv)
return hp[0]
end
def pbBaseDamage(basedmg,attacker,opponent)
hp=pbHiddenPower(attacker.iv)
return hp[1]
end
def pbIsPhysical?(type,attacker)
if attacker.attack==attacker.spatk
if attacker.defense==attacker.spdef
return ($Trainer.id)%2==0
end
return attacker.defense>attacker.spdef
end
return attacker.attack>attacker.spatk
end
def pbIsSpecial?(type,attacker)
if attacker.attack==attacker.spatk
if attacker.defense==attacker.spdef
return ($Trainer.id)%2==1
end
return attacker.defense<attacker.spdef
end
return attacker.attack<attacker.spatk
end
end
def pbHiddenPower(iv)
powermin=30
powermax=70
type=0; base=0
types=[]
for i in 0..PBTypes.maxValue
types.push(i) if !PBTypes.isPseudoType?(i) && !isConst?(i,PBTypes,:FAIRY) &&
!isConst?(i,PBTypes,:NORMAL) && !isConst?(i,PBTypes,:SHADOW)
end
type|=(iv[PBStats::HP]&1)
type|=(iv[PBStats::ATTACK]&1)<<1
type|=(iv[PBStats::DEFENSE]&1)<<2
type|=(iv[PBStats::SPEED]&1)<<3
type|=(iv[PBStats::SPATK]&1)<<4
type|=(iv[PBStats::SPDEF]&1)<<5
type=(type*(types.length-1)/63).floor
hptype=types[type]
base|=(iv[PBStats::HP]&2)>>1
base|=(iv[PBStats::ATTACK]&2)
base|=(iv[PBStats::DEFENSE]&2)<<1
base|=(iv[PBStats::SPEED]&2)<<2
base|=(iv[PBStats::SPATK]&2)<<3
base|=(iv[PBStats::SPDEF]&2)<<4
base=(base*(powermax-powermin)/63).floor+powermin
return [hptype,base]
end
Very interesting. Perhaps it could randomize a variable and take the even or odd.
Did you test this? Using Hidden Power does absolutely nothing. Moreover, after the turn in which I use it, that means, the next turn after that, I will again get the "xxx used Hidden Power!" message, again doing nothing.
That's very very odd. I didn't make any changes that could have made it a two-turn attack, and I'm applying the same logic to physicality and specialness that Hidden Power, Weather Ball, and Judgement/Techno Blast apply to type. Maybe we need Maruno or Mej to tell us what I'm doing wrong.
You're telling me that it does nothing even after the changes in post #4?
if @function==90 # Hidden Power
type=getConst(PBTypes,:NORMAL) || 0
end
No, I doubt that's it. The line of code you're quoting is just so moves like Bide and Mirror Coat count HP damage as Normal type damage, not whatever the Hidden Power actually was.Yeah, I'm checking if it could have been something I shouldn't have touched, but no,
Perhaps it's related to PkBattle_Move line 1065?
Perhaps that's trying to set it as a normal type move, and then the function 90 excludes Normal type from the calculation, so it does nothing.Code:if @function==90 # Hidden Power type=getConst(PBTypes,:NORMAL) || 0 end
Okay, so it's not a two-turn attack, it's just the attack doesn't stop because it doesn't do damage. Hmm...Upon another check, it's not that the message repeats, but rather that the last message hadn't ended by the time I was choosing a new command, because it also happened with the dummy Blissey's attack. It got stuck after I chose my next move.
No, I doubt that's it. The line of code you're quoting is just so moves like Bide and Mirror Coat count HP damage as Normal type damage, not whatever the Hidden Power actually was.
The "Exclusion of normal" is so the game ignores Normal type when counting the number of types that Hidden Power can be.
Okay, so it's not a two-turn attack, it's just the attack doesn't stop because it doesn't do damage. Hmm...
if type>=0 && pbIsSpecial?(type,attacker)
EDIT: Okay, I've found instances of pbIsPhysical? and pbIsSpecial? in PokeBattle_Battler, PokeBattle_Battle, and PokeBattle_AI. Will need to edit those, too.
You ninja'd me with the previous post and my edit, so quoting to be sure you saw.
,attacker=nil
Adding
? Even to those that didn't have "attacker)" before?Code:,attacker=nil
On my way!
move.pbIsPhysical?(movetype)
move.pbIsPhysical?(movetype[COLOR="Red"],user[/COLOR])
move.pbIsSpecial?(movetype[COLOR="red"],user[/COLOR])
if thispkmn.hasWorkingItem(:ASSAULTVEST) && !(thismove.pbIsPhysical?(thismove.type[COLOR="red"],thispkmn[/COLOR]) || thismove.pbIsSpecial?(thismove.type[COLOR="red"],thispkmn[/COLOR]))
It's working! I'm testing several Pokémon against a Wobbufet. When Aerodactly uses it, Mirror Coat fails, and Counter works. When Magneton uses it, the opposite happens.
YOU DID IT
Now I'm trying to figure out how to ignore all those calculations and make it only use a certain type for all species, but that's easy compared to everything else.
Woot!
Are you considering removing the "type is determined by the User's IVs" mechanic? Just remove the entire "def pbType" function from the Hidden Power code in Pokebattle_MoveEffects
Well, PokeCommunity does sometimes say "You're a wizard, Rot8er_Cone/" in the upper right corner, but I'd hardly call what I do "magic". I'm just really good at learning how code works by reading it, thanks to my father teaching me to be a hands-on guy.You must be a wizard, because what you do is magic.