コード例 #1
0
    public void ApplyStatusEffectsBasedOnStats(Stats inStats)
    {
        long chancePoison = inStats.Get(Stat.chance_to_psn);
        long chanceBurn   = inStats.Get(Stat.chance_to_burn);
        long chanceStun   = inStats.Get(Stat.chance_to_stun);
        long chanceFood   = inStats.Get(Stat.chance_for_food);

        if (chancePoison > 0)
        {
            if (Utils.PercentageChance((int)chancePoison))
            {
                statusEffects.Add(StatusEffect.CreateNew(StatusEffectType.POISON, 3));
            }
        }

        if (chanceBurn > 0)
        {
            if (Utils.PercentageChance((int)chanceBurn))
            {
                statusEffects.Add(StatusEffect.CreateNew(StatusEffectType.BURN, 3));
            }
        }

        if (chanceStun > 0)
        {
            if (Utils.PercentageChance((int)chanceStun))
            {
                statusEffects.Add(StatusEffect.CreateNew(StatusEffectType.STUNNED, GameContext.STUN_TURN_DURATION));
            }
        }

        if (chanceFood > 0)
        {
            if (Utils.PercentageChance((int)chanceFood))
            {
                itemIdEarnedOnHit = Item.GetRandomFoodItemId();
            }
        }
    }