Toxocious / Absolute

An online multi-player Pokemon RPG with in-depth battling, trading, map exploration, real-time chatting, and more.
MIT License
4 stars 2 forks source link

Extend Move Sub-Classes From Main Move Class #4

Closed Toxocious closed 1 year ago

Toxocious commented 2 years ago

Description

In order to avoid setting all move properties on construct each time a distinct move class is instantiated (new $Move_Class()), have all distinct move classes extend Move instead of extend Battle.

Currently, distinct move classes extend Battle due to some distinct moves using Battle specific properties/methods (whoops), but should be refactored in a way to not need to be extended off of the main Battle class itself.

Details

Current Structure

class MOVE_CLASS_NAME extends Battle
{
    // properties, all set to null

    public function __construct(Move $Move_Data)
    {
        // setting properties based on $Move_Data values
    }

    // move specific methods
}

Proposed Structure

class MOVE_CLASS_NAME extends Move
{
    public function __construct(int $Move_ID, int $Slot)
    {
        parent::__construct();
    }

    // move specific methods
}
Toxocious commented 1 year ago

This was completed as of commit cb7674eccc532c53794edbed5652e5d61da57e52.