Example #1
0
        public static double GetMatchup(GotchiType offendingType, GotchiType defendingType)
        {
            foreach (string key in offendingType._matchups.Keys)
            {
                if (defendingType.Matches(key))
                {
                    return(offendingType._matchups[key]);
                }
            }

            return(1.0);
        }
        public async Task <GotchiType[]> GetTypesAsync(string[] typeNames)
        {
            List <GotchiType> types = new List <GotchiType>();

            foreach (string typeName in typeNames)
            {
                GotchiType type = await GetTypeAsync(typeName);

                if (type != null)
                {
                    types.Add(type);
                }
            }

            return(types.ToArray());
        }
        public async Task RegisterAsync(string typeFilePath)
        {
            Script script = LuaUtils.CreateAndInitializeScript();

            try {
                await script.DoFileAsync(typeFilePath);

                GotchiType type = new GotchiType();

                script.Call(script.Globals["OnRegister"], type);

                _registry.Add(type);
            }
            catch (Exception) {
                await _logAsync(LogSeverity.Error, string.Format("Failed to register type {0}", System.IO.Path.GetFileName(typeFilePath)));
            }
        }
Example #4
0
 public double GetMatchup(GotchiType defensiveType)
 {
     return(GetMatchup(this, defensiveType));
 }