示例#1
0
        protected override void OnTick()
        {
            if (LastTickTime > lastUpdate)
            {
                foreach (MapObject obj in ObjectsInRegion)
                {
                    if (obj.IsSetForDeletion)
                    {
                        continue;
                    }

                    VBCharacter tmpChar = obj as VBCharacter;
                    if (tmpChar != null)
                    {
                        //notify player and hurt him
                        float range = (tmpChar.Position - Position).Normalize();

                        if (range < DamageRange)
                        {
                            tmpChar.DoDamage(this, tmpChar.Position, null, DamagePerUpdate, false);
                        }

                        GeigerCounter tmpCounter = tmpChar.ActiveHeldItem as GeigerCounter;
                        if (tmpCounter != null)
                        {
                            tmpCounter.UpdateSourceRange(range - DamageRange);
                        }
                    }
                }

                lastUpdate = LastTickTime + NextUpdate;
            }

            base.OnTick();
        }
示例#2
0
        bool UnlockBySkill(VBCharacter activator)
        {
            if (string.IsNullOrEmpty(enableSkill))
            {
                return(false);
            }

            string[] commandData = enableSkill.Split('$');
            if (commandData.Length < 2)
            {
                return(false);
            }

            //if im a player but my skillqueue isnt this return false
            VBCharacter plr = (activator as VBCharacter);

            if (plr != null && plr.SkillQueue != commandData[0])
            {
                return(false);
            }

            int skill = activator.GetCharStat(commandData[0]);

            if (skill != -1 && skill >= Convert.ToInt32(commandData[1]))
            {
                Disable();
            }
            else
            {
                Log.Info("Failed to unlock using {0}. Level {1} required", commandData[0], commandData[1]);
            }

            return(true);
        }
示例#3
0
        public override bool Interact(Dynamic activator)
        {
            if (disabled)
            {
                VBCharacter act_char = activator as VBCharacter;
                if (act_char != null)
                {
                    AttemptUnlock(act_char);
                }
            }

            return(base.Interact(activator));
        }
示例#4
0
        public void ApplyInfo(VBCharacter avatar)
        {
            tmpUnit       = avatar;
            avatar.Health = life;

            if (statistics != null)
            {
                avatar.PrimaryStatistics = ConstructStatistics();
            }

            if (inventory != null)
            {
                avatar.Inventory = inventory;
            }
        }
示例#5
0
        bool UnlockByItem(VBCharacter activator)
        {
            if (string.IsNullOrEmpty(enableType))
            {
                return(false);
            }

            if (activator.GetCurItem != null && activator.GetCurItem.ItemType.Name == enableType)
            {
                Disable();
                return(true);
            }

            return(false);
        }
示例#6
0
        public void AttemptUnlock(VBCharacter activator)
        {
            //try have an item to do it
            if (UnlockByItem(activator))
            {
                return;
            }

            if (UnlockBySkill(activator))
            {
                return;
            }

            //notify locked
            if (!string.IsNullOrEmpty(Type.disabledMessage))
            {
                Log.Info(Type.disabledMessage);
            }
        }
示例#7
0
        public void CreateCombatantList(VBUnitAI ch)
        {
            Map.Instance.GetObjects(new Sphere(ch.ControlledObject.Position, ch.ControlledObject.ViewRadius + 30), MapObjectSceneGraphGroups.UnitGroupMask, delegate(MapObject mapObject)
            {
                VBCharacter c = mapObject as VBCharacter;
                if (c != null)
                {
                    combatants.AddLast(c.Intellect);
                }
            });

            //reset all tasks
            foreach (VBUnitAI combatant in combatants)
            {
                combatant.ResetForCombat();
            }

            starter = activeEnt = ch;
            ch.InitiatetTurn();

            //TODO: ARRANGE LIST BY SEQUENCE
        }