示例#1
0
        private bool IsAddPowerAreaModifier(MainShipPowerAreaInfo info, ModifierBase modifier)
        {
            ModifierData oldData = info.areaModifier.GetModifierByID(modifier.ModifierName);

            if (oldData != null)
            {
                switch (modifier.OverlapType)
                {
                case ModifierOverlapType.TimeReset:
                    oldData.ResetTime();
                    break;
                }
                return(true);
            }
            return(false);
        }
示例#2
0
        public void AddMainShipPowerAreaModifier(FunctionBlockBase block, MainShipPowerAreaInfo areaInfo, ModifierBase modifierBase)
        {
            if (modifierBase == null)
            {
                DebugPlus.LogError("Modifier Base Data is null");
                return;
            }
            if (modifierBase.ParseTargetType(modifierBase.Target) != ModifierTarget.MainShipPowerArea)
            {
                DebugPlus.LogError("ModifierTargetError  Name=" + modifierBase.ModifierName);
                return;
            }

            ModifierData data = null;

            switch (modifierBase.ParseModifierPowerAreaType(modifierBase.effectType))
            {
            case ModifierMainShip_PowerArea.EnergyStorageMax:
                //Modifier Speed
                if (!IsAddPowerAreaModifier(areaInfo, modifierBase))
                {
                    data = ModifierData.Create(modifierBase, delegate
                    {
                        areaInfo.AddMaxStoragePower(block.info.modifierRootType, block.instanceID, block.info.BlockID, (int)modifierBase.Value);
                    });
                }
                break;

            case ModifierMainShip_PowerArea.AreaDurability:
                if (!IsAddPowerAreaModifier(areaInfo, modifierBase))
                {
                    data = ModifierData.Create(modifierBase, delegate
                    {
                        areaInfo.ChangeAreaDurability_Max(block.info.modifierRootType, block.instanceID, block.info.BlockID, (int)modifierBase.Value);
                    });
                }
                break;
            }

            if (data != null)
            {
                ///ADD modifier
                areaInfo.areaModifier.OnAddModifier(data);
            }
        }
示例#3
0
 public void AddMainShipPowerAreaModifier(FunctionBlockBase block, MainShipPowerAreaInfo areaInfo, string modifierName)
 {
     AddMainShipPowerAreaModifier(block, areaInfo, GetModifierBase(modifierName));
 }