Hello everyone, I want to buff Hail and add a few new weather effects to the game. I cloned the source repo and have been looking through the functions defined in battle.cpp which seem related to this -- primarily the applyaeffects() function which is called in the ability file whenever something related happens. This expects a QString and is called latter by callforth, where the string passed is "WeatherChange" I can't figure out the structure of this software -- where is the code that actually outlines which ability effects are triggered by callForth? The goal here is to buff Hail/Gravity and make them real weather conditions. Thank You
applyaeffects is ability effects, which is weather starters (Snow Warning, etc.) callForth just starts the weather. if you want to buff the weather to where moves/abilities interact better, look at MMThunder or AMSandVeil in their respective files to see how those interact with current weathers. if you want to buff the weather to do something else, you have to be more specific so i can point you in the right direction ~~~ Gravity is all defined in MMGravity, anything you want to do can and should be changed there.
Thanks, I think I finally started figuring it out. in battle.cpp I added the following to the getStat function if (gen() >= 4 && stat == Defense && isWeatherWorking(Hail) && hasType(player,Pokemon::Ice)) ret = ret * 3 / 2; That's where you actually implement stat modifications (copied your SandStorm implementation) The other weather buffs seem to be in CalculateDamage() and in general exceptions or modifiers are just coded into the routines in charge of that BattleSituation One other question I see is in your implementation of Stealth Rock. I'd like to make this a double layered move like Toxic Spikes; I was able to rewrite MMStealthRock() to function in this way -- but the "StealthRock" variable is expected to be of type Bool and not Type Int. Is there a centralized place where all the "team" flags types are defined so I can change "StealthRock"'s type to int? And a third Question -- I made this change to AMGaleWings(): struct AMGaleWings : public AM { AMGaleWings() { functions["PriorityChoice"] = &pc; } static void pc(int s, int, BS &b) { int type = poke(b,s)["AbilityArg"].toInt(); if (tmove(b,s).type == type) tmove(b,s).priority += 1; } }; It seems form looking at some of the other functions that this is the pattern you're using for arguments like type. my one question about this is does tmove(b,s).type return the type integer (so my code is correct) or does it return the type string?
Should return an integer. The reason toInt gets called is because the code cannot know the return value of "AbilityArg" until after it gets it, so it needs to call toInt before using it.
Thanks. I was wondering where I can edit "BattleMemory's" struct defintion I want to create new abilities for dialga/palka based on the template left for Gravity, but with a new set of effects; namely priority moves don't work for 5 turns after dialga switches in. I can get this to work either by creating a new weather or by defining "TimeDilationCount" and "TimeDilation" booleans in BattleMemory, and setting priority to 0 if it's active. I tried modifying SlowStart to work but ran into the above issue (I want it to last for 5 turns after Dialga's switch in, not automatically stop or reset when he leaves). I'd appreciate it greatly if someone could walk me through how to edit/add new variable to BattleMemory (or more generally, how to create a new weather type flag that disappears after a set number of turns like the existing weather effects)