Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A ton of errors #7

Open
Weegiepie opened this issue Oct 16, 2019 · 0 comments
Open

A ton of errors #7

Weegiepie opened this issue Oct 16, 2019 · 0 comments

Comments

@Weegiepie
Copy link

Weegiepie commented Oct 16, 2019

Hello! I wanted to try your program to entertain myself whenever I was bored, but there are a ton of errors that I can't seem to fix. Since this is your program, could you look at the errors and see if you can fix them? Thanks!

` public sealed class StatStageModifiers
{
private int attack;
public int Attack
{ get => attack; private set { attack = value; } }

    private int defense;
    public int Defense
    { get => defense; private set { defense = value; } }

    private int special;
    public int Special
    { get => special; private set { special = value; } }

    private int speed;
    public int Speed
    { get => speed; private set { speed = value; } }

    private int accuracy;
    public int Accuracy
    { get => accuracy; private set { accuracy = value; } }

    private int evasion;
    public int Evasion
    { get => evasion; private set { evasion = value; } }
    


    public bool CanGoHigher(StatType type) =>
        GetModifierForType(type) < 6;

    public bool CanGoLower(StatType type) =>
        GetModifierForType(type) > -6;



    public void Modify(StatType type, int delta)
    {
        ref int stat = ref GetModifierForType(type);
        stat += delta;
        if (stat > 6) stat = 6;
        if (stat < 0) stat = 0;
    }
    


    public void Reset()
    {
        attack = 0;
        defense = 0;
        special = 0;
        speed = 0;
        accuracy = 0;
        evasion = 0;
    }



    public StatStageModifiers() { }
    
    public StatStageModifiers(
        int attack,
        int defense,
        int special,
        int speed,
        int accuracy,
        int evasion)
    {
        this.attack = attack;
        this.defense = defense;
        this.special = special;
        this.speed = speed;
        this.accuracy = accuracy;
        this.evasion = evasion;
    }



    private ref int GetModifierForType(StatType type)
    {
        switch (type)
        {
            case StatType.Attack: return ref attack;
            case StatType.Defense: return ref defense;
            case StatType.Special: return ref special;
            case StatType.Speed: return ref speed;
            case StatType.Accuracy: return ref accuracy;
            case StatType.Evasion: return ref evasion;
            default: throw new System.Exception("You changed the StatType enum; update GetRefToModiferOfType");
        }
    }
}

}
`
Pokemon.cs

public string Nickname { get => nickname ?? Species; set { nickname = value; } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@Weegiepie and others