1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Guest, PO has ceased our separate tiering and adopted Smogon tiers for SM. More information and updates here.

    Dismiss Notice

Where is the Source code that defines the effects tied to a specific weather integer?

Discussion in 'Database Modifications' started by QuantumPencil, Apr 2, 2016.

  1. QuantumPencil

    QuantumPencil New Member

    Joined:
    Apr 2, 2016
    Messages:
    3
    Likes Received:
    0
    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
     
  2. Fuzzysqurl

    Fuzzysqurl baa baa mareep I do what I want Server Owner Developer I do what I want Server Owner Developer

    Joined:
    Sep 12, 2012
    Messages:
    2,096
    Likes Received:
    967
    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.
     
  3. QuantumPencil

    QuantumPencil New Member

    Joined:
    Apr 2, 2016
    Messages:
    3
    Likes Received:
    0
    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?
     
    Last edited: Apr 2, 2016
  4. sulcata

    sulcata stéphane curry best waifu Forum Moderator Server Administrator Forum Moderator Server Administrator

    Joined:
    Jun 13, 2012
    Messages:
    968
    Likes Received:
    744
    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.
     
  5. QuantumPencil

    QuantumPencil New Member

    Joined:
    Apr 2, 2016
    Messages:
    3
    Likes Received:
    0
    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)