VicFrank / PokemonRPGDemo

0 stars 0 forks source link

Fix Ability Level Up #66

Closed VicFrank closed 8 years ago

VicFrank commented 8 years ago

STATES: Normal Battle PostBattle

When a trainer engages with a wild pokemon, they should be marked as In Battle, and should stay that way until they've defeated a wild pokemon.

After the wild pokemon is defeated, the trainer should be put into a Post Battle state while we handle Experience/Level Up/Learn New Move/the rest of the RPGNotification Queue. While they are going through these screens, they should be locked from withdrawing/using pokemon. When the queue is empty, send a message to the server setting trainer state back to Normal.

If the wild pokemon deletes itself without being defeated, the trainer state should be sent directly back to Normal.

Therefore, state should be updated from Battle whenever a wild pokemon dies. The defeated pokemon should therefore keep track of what Trainers it has forced into the battle state.

The current system for leveling up relies on the relevant Pokemon Avatar being out, however, this can cause several potential issues. A much better way to do this would be as follows:

Instead of creating the Ability Panel on the fly, create it when you first get the panel creation prompt, and save that panel to be displayed later.

Example Code:

Add the ability codes to the 104 msg entindex() ?

AddTextBox(msg) if(msg.code == 104) thisTextBox.abilties[] = the 5 abilities

UpdateAbilityPanel() for ( var i = 0; i < 5; ++i ) var ability = currentTextBox.ability[i];

in gamemode.lua DeleteAbility() should only remove the ability from the meta data.

Because you're locked from creating a pokemonAvatar, just deleting the meta data ability will be enough to ensure you never have more than 5 abilities.

Another thing to consider is forcefully dragging trainers into battle when they walk through the tall grass, that is, forcefully withdrawing their first pokemon and putting the trainer into the battle state. You could also look at trainer state so as to only spawn Pokemon when the trainer is 'Normal,' but that might allow the trainer to walk through an area while they are in battle. Therefore, it might be wise to root the trainer in position during battle.

It also might mean that we get rid of the trainer's ability to send out pokemon outside of battle.

It should also be considered that multiple trainers might be involved in a battle.