Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class ConditionsDB
- {
- public static void Init()
- {
- foreach (var kvp in Conditions)
- {
- var conditionId = kvp.Key;
- var condition = kvp.Value;
- condition.Id = conditionId;
- }
- }
- public static Dictionary<ConditionID, Condition> Conditions { get; set; } = new Dictionary<ConditionID, Condition>()
- {
- {
- ConditionID.psn,
- new Condition()
- {
- Name = "Poison",
- StartMessage = "has been poisoned",
- OnAfterTurn = (MonsterGirl monsterGirl) =>
- {
- monsterGirl.UpdateHP(monsterGirl.MaxHP /8);
- monsterGirl.StatusChanges.Enqueue($"{monsterGirl.Base.Name} is hurt due to poison");
- }
- }
- },
- {
- ConditionID.brn,
- new Condition()
- {
- Name = "Burn",
- StartMessage = "has been burned",
- OnAfterTurn = (MonsterGirl monsterGirl) =>
- {
- monsterGirl.UpdateHP(monsterGirl.MaxHP / 16);
- monsterGirl.StatusChanges.Enqueue($"{monsterGirl.Base.Name} is hurt due to burn");
- }
- }
- },
- {
- ConditionID.par,
- new Condition()
- {
- Name = "Paralyzed",
- StartMessage = "has been paralyzed",
- OnBeforeTurn = (MonsterGirl monsterGirl) =>
- {
- if (Random.Range(1, 5) == 1)
- {
- monsterGirl.StatusChanges.Enqueue($"{monsterGirl.Base.Name} felt numb and is unable to move");
- return false;
- }
- return true;
- }
- }
- },
- {
- ConditionID.frz,
- new Condition()
- {
- Name = "Freeze",
- StartMessage = "has been frozen",
- OnBeforeTurn = (MonsterGirl monsterGirl) =>
- {
- if (Random.Range(1, 5) == 1)
- {
- monsterGirl.CureStatus();
- monsterGirl.StatusChanges.Enqueue($"{monsterGirl.Base.Name} is no longer frozen");
- return true;
- }
- return false;
- }
- }
- },
- {
- ConditionID.slp,
- new Condition()
- {
- Name = "Sleep",
- StartMessage = "has fallen asleep",
- OnStart = (MonsterGirl monstergirl) =>
- {
- //Sleep for 1-3 turns
- monstergirl.StatusTime = Random.Range(1, 4);
- Debug.Log($"Will be asleep for {monstergirl.StatusTime} turns");
- },
- OnBeforeTurn = (MonsterGirl monsterGirl) =>
- {
- if (monsterGirl.StatusTime <= 0)
- {
- monsterGirl.CureStatus();
- monsterGirl.StatusChanges.Enqueue($"{monsterGirl.Base.Name} woke up!");
- return true;
- }
- monsterGirl.StatusTime--;
- monsterGirl.StatusChanges.Enqueue($"{monsterGirl.Base.Name} is still fast asleep");
- return false;
- }
- }
- }
- };
- }
- public enum ConditionID
- {
- none, psn, brn, slp, par, frz
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement