示例#1
0
 public void Initialize(PlayerStats playerStats, ModifiableStat stat, Action <PlayerStatWithModifiers> callback)
 {
     this.playerStats = playerStats;
     this.theStat     = (PlayerStatWithModifiers)playerStats.GetStat(stat);
     this.callback    = callback;
     this.UpdateUIValues();
 }
示例#2
0
 // Setup stat pairs for like hp/max hp and mana/max mana
 private void SetupStatPair(PlayerRawStat curStat, PlayerStatWithModifiers maxStat)
 {
     curStat.SetMinMax(0, maxStat.GetBaseValue());
     //curStat.SetValue(maxStat.GetBaseValue());
     maxStat.SetCallback((int maxValue) => curStat.SetMinMax(0, maxValue));
     //maxStat.divisor = 3;
 }
示例#3
0
 public void RefreshStatsBasedOnLevel()
 {
     foreach (KeyValuePair <ModifiableStat, PlayerStatWithModifiers> statPair in this.modifiableStats)
     {
         PlayerStatWithModifiers statWithModifiers = statPair.Value;
         statWithModifiers.ApplyBaseValueBasedOnLevel(this.level);
     }
 }
示例#4
0
    public void LevelUpStat(PlayerStatWithModifiers stat)
    {
        // Nothing for now
        heroPlayer.stats.LevelUpStat(stat.stat);
        this.UpdateStatText();

        foreach (StatRewardUI rewardUI in this.statRewardUIs)
        {
            rewardUI.UpdateUIValues();
        }
    }
示例#5
0
    // Resetter ------------------//
    public void ResetStats()
    {
        foreach (KeyValuePair <ModifiableStat, PlayerStatWithModifiers> statPair in this.modifiableStats)
        {
            PlayerStatWithModifiers stat = statPair.Value;
            stat.ClearModifiers();
            stat.GetValue();
        }

        this.SetHPMPToMax();
    }
示例#6
0
    public object Clone()
    {
        PlayerStatWithModifiers     stat            = new PlayerStatWithModifiers(this.stat, this.baseValue, this.growth, this.divisor, this.callback);
        PriorityList <StatModifier> clonedModifiers = new PriorityList <StatModifier>();

        foreach (StatModifier modifier in this.modifiers)
        {
            clonedModifiers.Add((StatModifier)modifier.Clone());
        }

        stat.modifiers = clonedModifiers;

        return(stat);
    }
    public override void ApplyTo(Fighter p)
    {
        this.playerStat = p.stats.GetStat(stat);

        //TODO: Possible Animation Modifications
        switch (type)
        {
        case Type.PERCENTAGE:
            _flatChange       = (int)Mathf.Ceil(playerStat.GetValue() * modifier);
            this.statModifier = playerStat.ApplyDeltaModifier(_flatChange, StatModifier.Type.FLAT);
            break;

        case Type.FLAT:
            _flatChange       = (int)modifier;
            this.statModifier = playerStat.ApplyDeltaModifier(_flatChange, StatModifier.Type.ADD_PERCENTAGE);
            break;
        }
        Debug.Log("Defending: " + _flatChange + " damage");
    }
示例#8
0
    // Level up stat. Used for hero.
    public bool LevelUpStat(ModifiableStat stat)
    {
        // TODO: FIX THIS
        if (!this.modifiableStats.ContainsKey(stat))
        {
            Debug.LogError("ERROR: Not assignable stat");
            return(false);
        }


        PlayerStatWithModifiers theStat = this.modifiableStats[stat];
        int costToLevelUp = StatLevelHelpers.GetCostToLevelUpStat(theStat.growth, theStat.divisor);

        theStat.growth += StatLevelHelpers.LEVEL_UP_GROWTH_INCREASE;
        theStat.ApplyBaseValueBasedOnLevel(this.level);
        this.statPoints -= costToLevelUp;

        return(true);
    }
示例#9
0
    public void Initialize(Action callback)
    {
        this.callback = callback;

        this.heroPlayer = GameManager.Instance.gameState.playerParty.GetHeroFighter();

        // TODO: move this somewhere else more appropriate
        this.heroPlayer.stats.LevelUp();

        this.UpdateStatText();
        Dictionary <ModifiableStat, PlayerStatWithModifiers> modifiableStats = this.heroPlayer.stats.GetModifiableStats();

        foreach (KeyValuePair <ModifiableStat, PlayerStatWithModifiers> statPair in modifiableStats)
        {
            PlayerStatWithModifiers stat           = statPair.Value;
            StatRewardUI            rewardInstance = Instantiate(statRewardUIPrefab, statRewardUIParent);
            rewardInstance.Initialize(heroPlayer.stats, stat.stat, this.LevelUpStat);
            this.statRewardUIs.Add(rewardInstance);
        }

        StartCoroutine(this.WaitForInput());
    }