using System.Collections.Generic;

namespace StoryEngine.Core
{
    public class Variables
    {
        private Dictionary<string, int> _dict = new Dictionary<string, int>();

        public int this[string key]
        {
            get { return _dict.ContainsKey(key) ? _dict[key] : default(int); }
            set { _dict[key] = value; }
        }

        public void Add(string key, int value)
        {
            var res = _dict[key] + value;
            _dict[key] = res > 0 ? res : 0;
        }

        public void Multiply(string key, float value)
        {
            _dict[key] = (int)(_dict[key] * value);
        }

        public bool Compare(string key1, string key2)
        {
            var value1 = (float)_dict[key1];
            var value2 = (float)_dict[key1];
            return value1 > value2;
        }
    }
}