private void setTarget(IMyTerminalBlock block)
        {
            if (block == null)
            {
                targetID = 0;
                return;
            }
            targetID = block.EntityId;
            HackingDifficulty entry = Configuration.getHackingDifficulty(block);

            targetDifficulty   = Math.Max(1, (float)(entry.DifficultyFactor * Configuration.getSetting(Settings.HACKSCALE).asFloat() * 0.8 * Math.Pow(getComputerCount(block.SlimBlock), 0.675)));
            targetTime         = entry.RequiredTime;
            cyclesUntilAttempt = targetTime;
            retaliatoryDamage  = Configuration.getSetting(Settings.HACKDAMAGE).asBoolean() ? entry.Retaliation : 0;
        }
示例#2
0
        public static HackingDifficulty getHackingDifficulty(string def)
        {
            HackingDifficulty get = null;

            hackMap.TryGetValue(def, out get);
            if (get != null)
            {
                return(get);
            }
            foreach (var entry in hackMap)
            {
                HackingDifficulty reaction = entry.Value;
                if (def.Contains(reaction.BlockType))
                {
                    hackMap.Add(def, reaction);
                    return(reaction);
                }
            }
            hackMap.Add(def, defaultDifficulty);
            return(defaultDifficulty);
        }