Example #1
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     UnityEditor.EditorGUILayout.BeginHorizontal();
     UnityEngine.GUILayout.Label("Method name:");
     methodName = UnityEditor.EditorGUILayout.TextField(methodName);
     UnityEditor.EditorGUILayout.EndHorizontal();
     useTargetVar = UnityEditor.EditorGUILayout.Toggle("Use other target", useTargetVar);
     if (useTargetVar)
     {
         UnityEditor.EditorGUILayout.BeginHorizontal();
         UnityEngine.GUILayout.Label("Target var name:");
         targetVarName = UnityEditor.EditorGUILayout.TextField(targetVarName);
         UnityEditor.EditorGUILayout.EndHorizontal();
     }
     paramType = (ParameterType)UnityEditor.EditorGUILayout.EnumPopup("Parameter:", paramType);
     if (paramType == ParameterType.VarValue)
     {
         UnityEditor.EditorGUILayout.BeginHorizontal();
         UnityEngine.GUILayout.Label("Var name:");
         paramTypeValue = UnityEditor.EditorGUILayout.TextField(paramTypeValue);
         UnityEditor.EditorGUILayout.EndHorizontal();
     }
     if (paramType == ParameterType.String)
     {
         UnityEditor.EditorGUILayout.BeginHorizontal();
         UnityEngine.GUILayout.Label("Value:");
         paramTypeValue = UnityEditor.EditorGUILayout.TextField(paramTypeValue);
         UnityEditor.EditorGUILayout.EndHorizontal();
     }
     #endif
 }
Example #2
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     desiredDistance = UnityEditor.EditorGUILayout.FloatField("distance:", desiredDistance);
     fleeFrom = UnityEditor.EditorGUILayout.TextField("from:", fleeFrom);
     #endif
 }
Example #3
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     int currentState = 0;
     List<string> stateNames = new List<string> ();
     stateNames.Add ("Select");
     for (int i = 0; i < intelligence.states.Count; i++) {
         string newStateName = intelligence.states [i].name;
         if (newState != null) {
             if (newState.name.Equals (newStateName, System.StringComparison.OrdinalIgnoreCase)) {
                 currentState = i + 1;
             }
         }
         stateNames.Add (newStateName);
     }
     EditorGUILayout.BeginHorizontal ();
     GUILayout.Label ("New State: ");
     int selectedState = EditorGUILayout.Popup (currentState, stateNames.ToArray ());
     EditorGUILayout.EndHorizontal ();
     if (selectedState > 0) {
         if (!parentState.name.Equals (intelligence.states [selectedState - 1].name)) {
             newState = intelligence.states [selectedState - 1];
         } else {
             Debug.LogWarning ("transitioning to self is useless.");
         }
     }
     #endif
 }
Example #4
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     UnityEditor.EditorGUILayout.BeginHorizontal();
     GUILayout.Label("Var name:");
     varName = UnityEditor.EditorGUILayout.TextField(varName);
     UnityEditor.EditorGUILayout.EndHorizontal();
     #endif
 }
Example #5
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     EditorGUILayout.BeginHorizontal();
     GUILayout.Label("Var Name:", GUILayout.Width(64));
     storeName = EditorGUILayout.TextField(storeName);
     EditorGUILayout.EndHorizontal();
         #endif
 }
Example #6
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     UnityEditor.EditorGUILayout.BeginHorizontal();
     UnityEngine.GUILayout.Label(new UnityEngine.GUIContent("Type:", "Only if this type is currently playing as continuous it will be stopped"));
     type = (SoundSet.ClipType)UnityEditor.EditorGUILayout.EnumPopup(type);
     UnityEditor.EditorGUILayout.EndHorizontal();
     #endif
 }
Example #7
0
 public override void DrawGUI(Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     GUILayout.BeginHorizontal();
     GUILayout.Label("Name:", GUILayout.Width(40));
     saveName = EditorGUILayout.TextField(saveName);
     GUILayout.EndHorizontal();
     #endif
 }
Example #8
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     EditorGUILayout.BeginHorizontal();
     GUILayout.Label("target var name: ");
     entityVarName = EditorGUILayout.TextField(entityVarName);
     EditorGUILayout.EndHorizontal();
     range = EditorGUILayout.FloatField("Range:", range);
     #endif
 }
Example #9
0
        public override void DrawGUI(Intelligence intelligence, CallbackCollection callbacks)
        {
            #if UNITY_EDITOR
            invert = EditorGUILayout.Toggle("Invert:", invert);
            GUILayout.Label(string.Format("If{0}:", invert ? " not" : ""));
            if (ifAction == null)
            {
                Type res = callbacks.TriggerActionPopup();
                if (res != null)
                {

                    ifAction = CreateInstance(res) as TriggerAction;
                    ifAction.name = res.Name;
                    callbacks.AddAsset(ifAction);
                }
            }
            else
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(ifAction.name);
                if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(20)))
                {
                    callbacks.RemoveAsset(ifAction);
                }
                EditorGUILayout.EndHorizontal();
                ifAction.DrawGUI(intelligence, callbacks);
                EditorGUILayout.EndVertical();
            }
            GUILayout.Label("Then:");
            if (thenAction == null)
            {
                Type res = callbacks.TriggerActionPopup();
                if (res != null)
                {
                    thenAction = CreateInstance(res) as TriggerAction;
                    thenAction.name = res.Name;
                    callbacks.AddAsset(thenAction);
                }
            }
            else
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(thenAction.name);
                if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(20)))
                {
                    callbacks.RemoveAsset(thenAction);
                }
                EditorGUILayout.EndHorizontal();
                thenAction.DrawGUI(intelligence, callbacks);
                EditorGUILayout.EndVertical();
            }
            #endif
        }
Example #10
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     type = (EntityMover.SpeedModType)UnityEditor.EditorGUILayout.EnumPopup("Type", type);
     timeout = UnityEditor.EditorGUILayout.FloatField("Timeout:", timeout);
     saveAsVar = UnityEditor.EditorGUILayout.Toggle("Save as var", saveAsVar);
     if (saveAsVar)
     {
         varName = UnityEditor.EditorGUILayout.TextField("var:", varName);
     }
     #endif
 }
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     target = (MessageTarget)EditorGUILayout.EnumPopup("Target:",target);
     type = (NotificationType)EditorGUILayout.EnumPopup("Type:", type);
     EditorGUILayout.BeginHorizontal();
     GUILayout.Label("Position var:", GUILayout.Width(74));
     positionVariableName = EditorGUILayout.TextField(positionVariableName);
     EditorGUILayout.EndHorizontal();
     radius = EditorGUILayout.FloatField("Radius:", radius);
     #endif
 }
Example #12
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     UnityEditor.EditorGUILayout.BeginHorizontal();
     GUILayout.Label("Type:");
     type = (SoundSet.ClipType)UnityEditor.EditorGUILayout.EnumPopup(type);
     UnityEditor.EditorGUILayout.EndHorizontal();
     UnityEditor.EditorGUILayout.BeginHorizontal();
     GUILayout.Label("Interval (if continuous):");
     interval = UnityEditor.EditorGUILayout.FloatField(interval);
     UnityEditor.EditorGUILayout.EndHorizontal();
     #endif
 }
Example #13
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     EditorGUILayout.BeginHorizontal();
     GUILayout.Label("Target var name:");
     entityVarName = EditorGUILayout.TextField(entityVarName);
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     GUILayout.Label("Interval:");
     interval = EditorGUILayout.Slider(interval, 0.1f, 2f);
     EditorGUILayout.EndHorizontal();
     damagePerAttack = EditorGUILayout.IntField(new GUIContent("Damage:", "per interval"), damagePerAttack);
     #endif
 }
Example #14
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     targetName = UnityEditor.EditorGUILayout.TextField("Target var:", targetName);
     triggerName = UnityEditor.EditorGUILayout.TextField("Trigger name:", triggerName);
     paramType = (ParameterType)UnityEditor.EditorGUILayout.EnumPopup("Parameter:", paramType);
     if (paramType == ParameterType.VarValue)
     {
         paramTypeValue = UnityEditor.EditorGUILayout.TextField("Var name:", paramTypeValue);
     }
     if (paramType == ParameterType.String)
     {
         paramTypeValue = UnityEditor.EditorGUILayout.TextField("Value:", paramTypeValue);
     }
     #endif
 }
Example #15
0
 public Control(Map m, Intelligence p1, Intelligence p2, Loop l)
 {
     this.m = m;
     this.l = l;
     l.addToUpdateList(this);
     if (!isHuman(p1) || !isHuman(p2))
     {
         AI = new RandomAI();
     }
     p1.Color = Intelligence.eColor.black;
     pList.Add(p1);
     p2.Color = Intelligence.eColor.white;
     pList.Add(p2);
     act = pList.ElementAt(0);
     AINext(null);
 }
Example #16
0
 public override void DrawGUI(Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     handledType = (NotificationType)EditorGUILayout.EnumPopup("Type:", handledType);
     savePosition = EditorGUILayout.Toggle("Save position", savePosition);
     if (savePosition)
     {
         EditorGUILayout.BeginHorizontal();
         GUILayout.Label("var name:", GUILayout.Width(60));
         varName = EditorGUILayout.TextField(varName);
         EditorGUILayout.EndHorizontal();
     }
     saveSender = EditorGUILayout.Toggle("Save sender", saveSender);
     if (saveSender)
     {
         EditorGUILayout.BeginHorizontal();
         GUILayout.Label("var name:", GUILayout.Width(80));
         senderVarName = EditorGUILayout.TextField(senderVarName);
         EditorGUILayout.EndHorizontal();
     }
     GUILayout.Label("Then:");
     if (action == null)
     {
         System.Type res = callbacks.TriggerActionPopup();
         if (res != null)
         {
             action = CreateInstance(res) as TriggerAction;
             action.name = res.Name;
             callbacks.AddAsset(action);
         }
     }
     else
     {
         if (action is HandleMessage) { callbacks.RemoveAsset(action); return; }
         EditorGUILayout.BeginVertical(EditorStyles.helpBox);
         EditorGUILayout.BeginHorizontal();
         GUILayout.Label(action.name);
         if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(20)))
         {
             callbacks.RemoveAsset(action);
         }
         EditorGUILayout.EndHorizontal();
         action.DrawGUI(intelligence, callbacks);
         EditorGUILayout.EndVertical();
     }
     #endif
 }
Example #17
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     Type = (TargetType)EditorGUILayout.EnumPopup("Type:", Type);
     targetClassification = (IntelligenceType) EditorGUILayout.EnumPopup("Classification:", targetClassification);
     range = EditorGUILayout.FloatField("Range:", range);
     checkLOS = EditorGUILayout.Toggle("Check LOS:", checkLOS);
     saveVar = EditorGUILayout.Toggle("Save", saveVar);
     if (saveVar)
     {
         EditorGUILayout.BeginHorizontal();
         GUILayout.Label("Var name:");
         storageVar = EditorGUILayout.TextField(storageVar);
         EditorGUILayout.EndHorizontal();
     }
     #endif
 }
Example #18
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     target = (TargetType)UnityEditor.EditorGUILayout.EnumPopup("Target:", target);
     if (target == TargetType.TargetVar)
     {
         UnityEditor.EditorGUILayout.BeginHorizontal();
         UnityEngine.GUILayout.Label("Target var name:");
         targetVarName = UnityEditor.EditorGUILayout.TextField(targetVarName);
         UnityEditor.EditorGUILayout.EndHorizontal();
     }
     UnityEditor.EditorGUILayout.BeginHorizontal();
     UnityEngine.GUILayout.Label("Save var name:");
     varName = UnityEditor.EditorGUILayout.TextField(varName);
     UnityEditor.EditorGUILayout.EndHorizontal();
     #endif
 }
Example #19
0
    //Use this for initialization
    void Start()
    {
        currentHealth = maxHealth;
        currentStamina = maxStamina;
        currentMS = 0;

        strength = GetComponent<Strength>();
        agility = GetComponent<Agility>();
        haste = GetComponent<Haste>();
        perception = GetComponent<Perception>();
        intelligence = GetComponent<Intelligence>();
        wisdom = GetComponent<Wisdom>();

        cont = GetComponent<CharacterController>();
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
        cameraReference = GameObject.FindWithTag("cameraReference");
        lookTarget = GameObject.FindWithTag("LookTarget");
    }
Example #20
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     posVarSource = (PositionSource)UnityEditor.EditorGUILayout.EnumPopup("Position source:", posVarSource);
     if (posVarSource == PositionSource.VarValue)
     {
         UnityEditor.EditorGUILayout.BeginHorizontal();
         GUILayout.Label("Postion var name:");
         posVarName = UnityEditor.EditorGUILayout.TextField(posVarName);
         UnityEditor.EditorGUILayout.EndHorizontal();
     }
     saveAsVar = UnityEditor.EditorGUILayout.Toggle("Save as var:", saveAsVar);
     if (saveAsVar)
     {
         UnityEditor.EditorGUILayout.BeginHorizontal();
         GUILayout.Label("Save var name:");
         saveVarName = UnityEditor.EditorGUILayout.TextField(saveVarName);
         UnityEditor.EditorGUILayout.EndHorizontal();
     }
     #endif
 }
Example #21
0
        public RacePropertiesStats(RaceProperties p)
        {
            this.intelligence              = p.intelligence;
            this.hasGenders                = p.hasGenders;
            this.needsRest                 = p.needsRest;
            this.nameCategory              = p.nameCategory;
            this.foodType                  = p.foodType;
            this.makesFootprints           = p.makesFootprints;
            this.executionRange            = p.executionRange;
            this.lifeExpectancy            = p.lifeExpectancy;
            this.herdAnimal                = p.herdAnimal;
            this.packAnimal                = p.packAnimal;
            this.predator                  = p.predator;
            this.maxPreyBodySize           = p.maxPreyBodySize;
            this.wildness                  = p.wildness;
            this.petness                   = p.petness;
            this.nuzzleMtbHours            = p.nuzzleMtbHours;
            this.manhunterOnDamageChance   = p.manhunterOnDamageChance;
            this.manhunterOnTameFailChance = p.manhunterOnTameFailChance;
            this.canBePredatorPrey         = p.canBePredatorPrey;
            this.herdMigrationAllowed      = p.herdMigrationAllowed;
            this.gestationPeriodDays       = p.gestationPeriodDays;
            this.mateMtbHours              = p.mateMtbHours;
            this.nameOnTameChance          = p.nameOnTameChance;
            //this.nameOnNuzzleChance = p.nameOnNuzzleChance;
            this.baseBodySize    = p.baseBodySize;
            this.baseHealthScale = p.baseHealthScale;
            this.baseHungerRate  = p.baseHungerRate;
            this.meatLabel       = p.meatLabel;
            this.meatMarketValue = p.meatMarketValue;

            this.meatColor = new ColorStats(p.meatColor);
            if (p.specialShadowData != null)
            {
                this.specialShadowData = new ShadowDataStats(p.specialShadowData);
            }
            if (p.soundCallIntervalRange != null)
            {
                this.soundCallIntervalRange = new MinMaxIntStats(p.soundCallIntervalRange);
            }
            if (p.ageGenerationCurve != null)
            {
                this.ageGenerationCurve = new SimpleCurveStats(p.ageGenerationCurve);
            }
            if (p.litterSizeCurve != null)
            {
                this.litterSizeCurve = new SimpleCurveStats(p.litterSizeCurve);
            }

            Util.Populate(out this.wildBiomes, p.wildBiomes, (v) => new FloatValueDefStat <BiomeDef>(v.biome, v.commonality));
            Util.Populate(out this.lifeStageAges, p.lifeStageAges, (v) => new LifeStageAgeStats(v));
            Util.Populate(out this.untrainableTags, p.untrainableTags);
            Util.Populate(out this.trainableTags, p.trainableTags);

            Util.AssignDefStat(GetFleshType(p), out this.fleshType);
            Util.AssignDefStat(GetBloodDef(p), out this.bloodDef);
            Util.AssignDefStat(p.thinkTreeMain, out this.thinkTreeMain);
            Util.AssignDefStat(p.thinkTreeConstant, out this.thinkTreeConstant);
            Util.AssignDefStat(p.body, out this.body);
            Util.AssignDefStat(p.trainability, out this.trainability);
            Util.AssignDefStat(GetNameGenerator(p), out this.nameGenerator);
            Util.AssignDefStat(GetNameGeneratorFemale(p), out this.nameGeneratorFemale);
            Util.AssignDefStat(p.useMeatFrom, out this.useMeatFrom);
            Util.AssignDefStat(p.useLeatherFrom, out this.useLeatherFrom);
            Util.AssignDefStat(p.leatherDef, out this.leatherDef);
            Util.AssignDefStat(p.soundMeleeHitPawn, out this.soundMeleeHitPawn);
            Util.AssignDefStat(p.soundMeleeHitBuilding, out this.soundMeleeHitBuilding);
            Util.AssignDefStat(p.soundMeleeMiss, out this.soundMeleeMiss);
            Util.AssignDefStat(p.meatDef, out this.meatDef);
            Util.AssignDefStat(p.corpseDef, out this.corpseDef);

            this.hediffGiverSets = Util.CreateDefStatList(p.hediffGiverSets);
        }
 protected override void GetNeededArmyPower(out float minMilitaryPower, out bool isMaxPower, out bool perUnitTest)
 {
     isMaxPower       = false;
     perUnitTest      = false;
     minMilitaryPower = Intelligence.EvaluateAllFactionMaxMilitaryPowerOnRegion(base.Commander.Empire, this.RegionTarget.Index, true);
 }
Example #23
0
    protected override void RefreshObjectives(StaticString context, StaticString pass)
    {
        this.PathingOrigin = this.GetPathingOrigin();
        DepartmentOfForeignAffairs agency = base.AIEntity.Empire.GetAgency <DepartmentOfForeignAffairs>();

        base.RefreshObjectives(context, pass);
        this.CurrentSettlerCount = this.GetSettlerCount();
        this.ComputeGlobalPriority();
        this.ComputeBestDefensiveArmypower();
        this.UpdateContinentData();
        int num = this.GetNumberOfAcceptedColonization();

        this.WantedNewCity = num;
        base.GatherObjectives(AICommanderMissionDefinition.AICommanderCategory.Colonization.ToString(), ref this.globalObjectiveMessages);
        base.ValidateMessages(ref this.globalObjectiveMessages);
        for (int i = 0; i < this.globalObjectiveMessages.Count; i++)
        {
            GlobalObjectiveMessage globalObjectiveMessage = this.globalObjectiveMessages[i];
            if (this.IsObjectiveValid(AICommanderMissionDefinition.AICommanderCategory.Colonization.ToString(), globalObjectiveMessage.RegionIndex, false))
            {
                if (agency.IsInWarWithSomeone())
                {
                    using (IEnumerator <Army> enumerator = Intelligence.GetArmiesInRegion(globalObjectiveMessage.RegionIndex).GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            Army army = enumerator.Current;
                            if (army.Empire != base.AIEntity.Empire && army.Empire is MajorEmpire && agency.IsAtWarWith(army.Empire))
                            {
                                base.AIEntity.AIPlayer.Blackboard.CancelMessage(this.globalObjectiveMessages[i]);
                            }
                        }
                        goto IL_18E;
                    }
                }
                if (num > 0 || this.CurrentSettlerCount > i)
                {
                    num--;
                    this.RefreshMessagePriority(globalObjectiveMessage);
                }
                else
                {
                    base.AIEntity.AIPlayer.Blackboard.CancelMessage(this.globalObjectiveMessages[i]);
                }
            }
            IL_18E :;
        }
        if (this.departmentOfTheInterior.Cities.Count == 0 && this.globalObjectiveMessages.Count == 0)
        {
            Region region3 = this.ChooseLastHopeRegion();
            if (region3 == null)
            {
                return;
            }
            this.CreateObjectiveFor(region3);
            num--;
        }
        Region region2 = null;

        for (int j = 0; j < num; j++)
        {
            region2 = this.GetNextRegionToColonize();
            if (region2 != null)
            {
                this.CreateObjectiveFor(region2);
            }
        }
        if (this.ForceShipyardResearch)
        {
            this.TryForceShipyardResearch();
        }
        else if (region2 == null && num > 0)
        {
            if (this.worldPositionningService.World.Continents.Length > 1)
            {
                this.TryForceShipyardResearch();
            }
            else if (this.continentData.Any((AILayer_Colonization.ContinentData c) => c.LandRegionCount > 0 && c.OverallColonizationPercent <= 0.8f))
            {
                this.TryForceShipyardResearch();
            }
        }
        this.WantToColonizeOversea = false;
        for (int k = 0; k < this.globalObjectiveMessages.Count; k++)
        {
            GlobalObjectiveMessage globalObjectiveMessage2 = this.globalObjectiveMessages[k];
            Region region = this.worldPositionningService.GetRegion(globalObjectiveMessage2.RegionIndex);
            if (!Array.Find <AILayer_Colonization.ContinentData>(this.continentData, (AILayer_Colonization.ContinentData match) => match.ContinentId == region.ContinentID).EmpireWithRegion.Contains(base.AIEntity.Empire))
            {
                this.WantToColonizeOversea = true;
                return;
            }
        }
    }
Example #24
0
        protected SideInfo(SerializationInfo info, StreamingContext ctx)
        {
            m_side = (Side)info.GetValue("m_side", typeof(Side));
            m_nInitialCredits = info.GetInt32("m_nInitialCredits");
            m_ptInitialView = (Point)info.GetValue("m_ptInitialView", typeof(Point));

            try {
                m_nIntelligence = (Intelligence)info.GetValue("m_nIntelligence", typeof(Intelligence));
            } catch (SerializationException) {
                m_nIntelligence = m_side == Side.side1 ? Intelligence.Human : Intelligence.ComputerOvermind;
            }
        }
Example #25
0
        /// <summary>
        /// Loads
        /// </summary>
        /// <param name="node">XmlNode handle</param>
        public virtual bool Load(XmlNode node)
        {
            if (node == null)
            {
                return(false);
            }


            if (node.NodeType == XmlNodeType.Comment)
            {
                return(false);
            }

            switch (node.Name.ToLower())
            {
            case "strength":
            {
                Strength.Load(node);
            }
            break;

            case "intelligence":
            {
                Intelligence.Load(node);
            }
            break;

            case "wisdom":
            {
                Wisdom.Load(node);
            }
            break;

            case "dexterity":
            {
                Dexterity.Load(node);
            }
            break;

            case "constitution":
            {
                Constitution.Load(node);
            }
            break;

            case "charisma":
            {
                Charisma.Load(node);
            }
            break;

            case "alignment":
            {
                Alignment = (EntityAlignment)Enum.Parse(typeof(EntityAlignment), node.Attributes["value"].Value, true);
            }
            break;

            case "hitpoint":
            {
                HitPoint.Load(node);
            }
            break;

            case "movespeed":
            {
                MoveSpeed = TimeSpan.FromMilliseconds(int.Parse(node.Attributes["value"].Value));
            }
            break;

            default:
            {
                Trace.WriteLine("[Entity] Load() : Unknown node : <{0}>", node.Name);
            }
            break;
            }


            return(true);
        }
Example #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BasePagePlugin"/> class with default page title "Demo".
 /// </summary>
 /// <param name="intelligence">The intelligence.</param>
 public BasePagePlugin(Intelligence.BaseIntelligence intelligence)
     : base(intelligence)
 {
     IsWelcomeScreen = false;
     PageTitle = "Demo";
 }
Example #27
0
        bool repeated = false; //minimize progress delay

        #endregion Fields

        #region Methods

        public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
        {
            #if UNITY_EDITOR
            ignorePathConfiguration = UnityEditor.EditorGUILayout.Toggle("Ignore point actions", ignorePathConfiguration);
                #endif
        }
Example #28
0
        public CharacterCharacteristicsInformations GetCharacterCharacteristics(Character character)
        {
            ulong expFloor     = ExperienceRecord.GetExperienceForLevel(character.Level).Player;
            ulong expNextFloor = ExperienceRecord.GetExperienceForNextLevel(character.Level).Player;

            CharacterCharacteristicsInformations informations = new CharacterCharacteristicsInformations()
            {
                actionPoints            = ActionPoints.GetBaseCharacteristic(),
                actionPointsCurrent     = ActionPoints.TotalInContext(),
                additionnalPoints       = 0,
                agility                 = Agility.GetBaseCharacteristic(),
                airDamageBonus          = AirDamageBonus.GetBaseCharacteristic(),
                airElementReduction     = AirReduction.GetBaseCharacteristic(),
                airElementResistPercent = AirResistPercent.GetBaseCharacteristic(),
                alignmentInfos          = character.Record.Alignment.GetActorExtendedAlignement(),
                allDamagesBonus         = AllDamagesBonus.GetBaseCharacteristic(),
                chance = Chance.GetBaseCharacteristic(),
                criticalDamageBonus          = CriticalDamageBonus.GetBaseCharacteristic(),
                criticalDamageReduction      = CriticalDamageReduction.GetBaseCharacteristic(),
                criticalHit                  = CriticalHit.GetBaseCharacteristic(),
                criticalHitWeapon            = CriticalHitWeapon,
                criticalMiss                 = Characteristic.Zero().GetBaseCharacteristic(),
                damagesBonusPercent          = DamagesBonusPercent.GetBaseCharacteristic(),
                dodgePALostProbability       = DodgePAProbability.GetBaseCharacteristic(),
                dodgePMLostProbability       = DodgePMProbability.GetBaseCharacteristic(),
                earthDamageBonus             = EarthDamageBonus.GetBaseCharacteristic(),
                earthElementReduction        = EarthReduction.GetBaseCharacteristic(),
                earthElementResistPercent    = EarthResistPercent.GetBaseCharacteristic(),
                pvpEarthElementReduction     = PvPEarthReduction.GetBaseCharacteristic(),
                pvpEarthElementResistPercent = PvPEarthResistPercent.GetBaseCharacteristic(),
                fireDamageBonus              = FireDamageBonus.GetBaseCharacteristic(),
                fireElementReduction         = FireReduction.GetBaseCharacteristic(),
                fireElementResistPercent     = FireResistPercent.GetBaseCharacteristic(),
                pvpFireElementReduction      = PvPFireReduction.GetBaseCharacteristic(),
                pvpFireElementResistPercent  = PvPFireResistPercent.GetBaseCharacteristic(),
                glyphBonusPercent            = GlyphBonusPercent.GetBaseCharacteristic(),
                healBonus                      = HealBonus.GetBaseCharacteristic(),
                initiative                     = new CharacterBaseCharacteristic((short)FormulasProvider.Instance.BaseInitiative(this), 0, Initiative.Total(), 0, 0),
                intelligence                   = Intelligence.GetBaseCharacteristic(),
                kamas                          = character.Record.Kamas,
                lifePoints                     = (uint)LifePoints,
                maxEnergyPoints                = MaxEnergyPoints,
                maxLifePoints                  = (uint)MaxLifePoints,
                movementPoints                 = MovementPoints.GetBaseCharacteristic(),
                movementPointsCurrent          = MovementPoints.TotalInContext(),
                PMAttack                       = PMAttack.GetBaseCharacteristic(),
                PAAttack                       = PAAttack.GetBaseCharacteristic(),
                pvpAirElementReduction         = PvPAirReduction.GetBaseCharacteristic(),
                pvpAirElementResistPercent     = PvPAirResistPercent.GetBaseCharacteristic(),
                pvpNeutralElementReduction     = PvPNeutralReduction.GetBaseCharacteristic(),
                pvpNeutralElementResistPercent = PvPNeutralResistPercent.GetBaseCharacteristic(),
                pvpWaterElementReduction       = PvPWaterReduction.GetBaseCharacteristic(),
                pvpWaterElementResistPercent   = PvPWaterResistPercent.GetBaseCharacteristic(),
                energyPoints                   = Energy,
                experience                     = character.Experience,
                experienceLevelFloor           = expFloor,
                experienceNextLevelFloor       = expNextFloor,
                neutralDamageBonus             = NeutralDamageBonus.GetBaseCharacteristic(),
                neutralElementReduction        = NeutralReduction.GetBaseCharacteristic(),
                neutralElementResistPercent    = NeutralResistPercent.GetBaseCharacteristic(),
                tackleEvade                    = TackleEvade.GetBaseCharacteristic(),
                tackleBlock                    = TackleBlock.GetBaseCharacteristic(),
                range                          = Range.GetBaseCharacteristic(),
                waterElementReduction          = WaterReduction.GetBaseCharacteristic(),
                waterDamageBonus               = WaterDamageBonus.GetBaseCharacteristic(),
                waterElementResistPercent      = WaterResistPercent.GetBaseCharacteristic(),
                reflect                        = Reflect.GetBaseCharacteristic(),
                permanentDamagePercent         = PermanentDamagePercent.GetBaseCharacteristic(),
                prospecting                    = Prospecting.GetBaseCharacteristic(),
                pushDamageBonus                = PushDamageBonus.GetBaseCharacteristic(),
                pushDamageReduction            = PushDamageReduction.GetBaseCharacteristic(),
                runeBonusPercent               = RuneBonusPercent.GetBaseCharacteristic(),
                spellModifications             = new CharacterSpellModification[0],
                spellsPoints                   = character.Record.SpellPoints,
                statsPoints                    = character.Record.StatsPoints,
                vitality                       = Vitality.GetBaseCharacteristic(),
                strength                       = Strength.GetBaseCharacteristic(),
                summonableCreaturesBoost       = SummonableCreaturesBoost.GetBaseCharacteristic(),
                trapBonus                      = TrapBonus.GetBaseCharacteristic(),
                trapBonusPercent               = TrapBonusPercent.GetBaseCharacteristic(),
                weaponDamagesBonusPercent      = WeaponDamagesBonusPercent.GetBaseCharacteristic(),
                wisdom                         = Wisdom.GetBaseCharacteristic(),
                probationTime                  = 0
            };

            return(informations);
        }
Example #29
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     varName = UnityEditor.EditorGUILayout.TextField("var:", varName);
     #endif
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseNetworkPlugin"/> class.
 /// </summary>
 /// <param name="intelligence">The intelligence.</param>
 public BaseNetworkPlugin(Intelligence.CoreIntelligence intelligence)
     : base(intelligence)
 {
 }
Example #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BasePlugin"/> class.
 /// </summary>
 /// <param name="intelligence">The intelligence.</param>
 public BasePlugin(Intelligence.BaseIntelligence intelligence)
 {
     RequiresLogin = true;
     Intelligence = intelligence;
 }
 private Stats parseJSONStats(JSONNode stats)
 {
     Teaching t = new Teaching(stats["teaching"][0].AsInt, stats["teaching"][1].AsInt,stats["teaching"][2].AsInt,stats["teaching"][3].AsInt,stats["teaching"][4].AsInt);
     Combat c = new Combat(stats["combat"][0].AsInt,stats["combat"][1].AsInt,stats["combat"][2].AsInt,stats["combat"][3].AsInt,stats["combat"][4].AsInt);
     Intelligence i = new Intelligence(stats["intelligence"][0].AsInt,stats["intelligence"][1].AsInt,stats["intelligence"][2].AsInt,stats["intelligence"][3].AsInt,stats["intelligence"][4].AsInt);
     return new Stats(t, c, i);
 }
Example #33
0
 /// <summary>
 /// Overrides the behaviour of this entity
 /// </summary>
 /// <param name="newBehaviour">selected behaviour to replace the old one</param>
 /// <returns></returns>
 public bool SetBehaviour(Intelligence newBehaviour)
 {
     if (behaviour != null) {
         Destroy (behaviour);
     }
     if (newBehaviour) {
         behaviour = Instantiate (newBehaviour);
         behaviour.Initialize (this);
         return true;
     }
     return false;
 }
 public void Serialize(IDataWriter writer)
 {
     writer.WriteVarLong(Experience);
     writer.WriteVarLong(ExperienceLevelFloor);
     writer.WriteVarLong(ExperienceNextLevelFloor);
     writer.WriteVarLong(ExperienceBonusLimit);
     writer.WriteVarLong(Kamas);
     writer.WriteVarShort((Int16)StatsPoints);
     writer.WriteVarShort((Int16)AdditionnalPoints);
     writer.WriteVarShort((Int16)SpellsPoints);
     AlignmentInfos.Serialize(writer);
     writer.WriteVarInt((Int32)LifePoints);
     writer.WriteVarInt((Int32)MaxLifePoints);
     writer.WriteVarShort((Int16)EnergyPoints);
     writer.WriteVarShort((Int16)MaxEnergyPoints);
     writer.WriteVarShort(ActionPointsCurrent);
     writer.WriteVarShort(MovementPointsCurrent);
     Initiative.Serialize(writer);
     Prospecting.Serialize(writer);
     ActionPoints.Serialize(writer);
     MovementPoints.Serialize(writer);
     Strength.Serialize(writer);
     Vitality.Serialize(writer);
     Wisdom.Serialize(writer);
     Chance.Serialize(writer);
     Agility.Serialize(writer);
     Intelligence.Serialize(writer);
     Range.Serialize(writer);
     SummonableCreaturesBoost.Serialize(writer);
     Reflect.Serialize(writer);
     CriticalHit.Serialize(writer);
     writer.WriteVarShort((Int16)CriticalHitWeapon);
     CriticalMiss.Serialize(writer);
     HealBonus.Serialize(writer);
     AllDamagesBonus.Serialize(writer);
     WeaponDamagesBonusPercent.Serialize(writer);
     DamagesBonusPercent.Serialize(writer);
     TrapBonus.Serialize(writer);
     TrapBonusPercent.Serialize(writer);
     GlyphBonusPercent.Serialize(writer);
     RuneBonusPercent.Serialize(writer);
     PermanentDamagePercent.Serialize(writer);
     TackleBlock.Serialize(writer);
     TackleEvade.Serialize(writer);
     PAAttack.Serialize(writer);
     PMAttack.Serialize(writer);
     PushDamageBonus.Serialize(writer);
     CriticalDamageBonus.Serialize(writer);
     NeutralDamageBonus.Serialize(writer);
     EarthDamageBonus.Serialize(writer);
     WaterDamageBonus.Serialize(writer);
     AirDamageBonus.Serialize(writer);
     FireDamageBonus.Serialize(writer);
     DodgePALostProbability.Serialize(writer);
     DodgePMLostProbability.Serialize(writer);
     NeutralElementResistPercent.Serialize(writer);
     EarthElementResistPercent.Serialize(writer);
     WaterElementResistPercent.Serialize(writer);
     AirElementResistPercent.Serialize(writer);
     FireElementResistPercent.Serialize(writer);
     NeutralElementReduction.Serialize(writer);
     EarthElementReduction.Serialize(writer);
     WaterElementReduction.Serialize(writer);
     AirElementReduction.Serialize(writer);
     FireElementReduction.Serialize(writer);
     PushDamageReduction.Serialize(writer);
     CriticalDamageReduction.Serialize(writer);
     PvpNeutralElementResistPercent.Serialize(writer);
     PvpEarthElementResistPercent.Serialize(writer);
     PvpWaterElementResistPercent.Serialize(writer);
     PvpAirElementResistPercent.Serialize(writer);
     PvpFireElementResistPercent.Serialize(writer);
     PvpNeutralElementReduction.Serialize(writer);
     PvpEarthElementReduction.Serialize(writer);
     PvpWaterElementReduction.Serialize(writer);
     PvpAirElementReduction.Serialize(writer);
     PvpFireElementReduction.Serialize(writer);
     MeleeDamageDonePercent.Serialize(writer);
     MeleeDamageReceivedPercent.Serialize(writer);
     RangedDamageDonePercent.Serialize(writer);
     RangedDamageReceivedPercent.Serialize(writer);
     WeaponDamageDonePercent.Serialize(writer);
     WeaponDamageReceivedPercent.Serialize(writer);
     SpellDamageDonePercent.Serialize(writer);
     SpellDamageReceivedPercent.Serialize(writer);
     for (var i = 0; i < SpellModifications.Length; i++)
     {
         SpellModifications[i].Serialize(writer);
     }
     writer.WriteInt((Int32)ProbationTime);
 }
Example #35
0
 internal override void SetIntelligence(Character character, int intelligence) => character.Intelligence = Intelligence.FromInteger(intelligence);
Example #36
0
 public uint Total()
 {
     return((uint)(Strength.Total() + Chance.Total() + Intelligence.Total() + Agility.Total()));
 }
Example #37
0
    public override void OnInspectorGUI()
    {
        MindComponent c = (MindComponent)target;

        Intelligence intelligenceNormal = c.mind.intelligenceNormal;
        Intelligence intelligenceReflex = c.mind.intelligenceReflex;

        AIModel aiModel = c.mind.AI_model;

        GUILayout.BeginHorizontal();
        if (aiModel.behaviors_normal != null && aiModel.behaviors_normal.Length > 0)
        {
            int           activeNormalComportIndex = intelligenceNormal.comport != null ? intelligenceNormal.comport.index + 1 : 0;
            List <string> normalComportStrings     = aiModel.behaviors_normal.Select(b => b.ToString()).ToList();
            normalComportStrings.Insert(0, "<null>");

            GUILayout.Label("Current normal behavior");
            int o = activeNormalComportIndex - 1;
            activeNormalComportIndex = EditorGUILayout.Popup(activeNormalComportIndex, normalComportStrings.ToArray()) - 1;
            if (activeNormalComportIndex != o)
            {
                c.writeNormalComport       = true;
                intelligenceNormal.comport = activeNormalComportIndex >= 0 ? aiModel.behaviors_normal[activeNormalComportIndex] : null;
            }
        }
        else
        {
            GUILayout.Label("No normal behaviors");
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (aiModel.behaviors_reflex != null && aiModel.behaviors_reflex.Length > 0)
        {
            int           activeReflexComportIndex = intelligenceReflex.comport != null ? intelligenceReflex.comport.index + 1 : 0;
            List <string> reflexComportStrings     = aiModel.behaviors_reflex.Select(b => b.ToString()).ToList();
            reflexComportStrings.Insert(0, "<null>");

            GUILayout.Label("Current reflex behavior");
            int o = activeReflexComportIndex - 1;
            activeReflexComportIndex = EditorGUILayout.Popup(activeReflexComportIndex, reflexComportStrings.ToArray()) - 1;
            if (activeReflexComportIndex != o)
            {
                c.writeReflexComport       = true;
                intelligenceReflex.comport = activeReflexComportIndex >= 0 ? aiModel.behaviors_reflex[activeReflexComportIndex] : null;
            }
        }
        else
        {
            GUILayout.Label("No reflex behaviors");
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (aiModel.behaviors_normal != null && aiModel.behaviors_normal.Length > 0)
        {
            int           activeInitialNormalComportIndex = intelligenceNormal.defaultComport != null ? intelligenceNormal.defaultComport.index + 1 : 0;
            List <string> normalComportStrings            = aiModel.behaviors_normal.Select(b => b.ToString()).ToList();
            normalComportStrings.Insert(0, "<null>");

            GUILayout.Label("Initial normal behavior");
            int o = activeInitialNormalComportIndex - 1;
            activeInitialNormalComportIndex = EditorGUILayout.Popup(activeInitialNormalComportIndex, normalComportStrings.ToArray()) - 1;
            if (activeInitialNormalComportIndex != o)
            {
                c.writeInitialNormalComport       = true;
                intelligenceNormal.defaultComport = activeInitialNormalComportIndex >= 0 ? aiModel.behaviors_normal[activeInitialNormalComportIndex] : null;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (aiModel.behaviors_reflex != null && aiModel.behaviors_reflex.Length > 0)
        {
            int           activeInitialReflexComportIndex = intelligenceReflex.defaultComport != null ? intelligenceReflex.defaultComport.index + 1 : 0;
            List <string> reflexComportStrings            = aiModel.behaviors_reflex.Select(b => b.ToString()).ToList();
            reflexComportStrings.Insert(0, "<null>");

            GUILayout.Label("Initial reflex behavior");
            int o = activeInitialReflexComportIndex - 1;
            activeInitialReflexComportIndex = EditorGUILayout.Popup(activeInitialReflexComportIndex, reflexComportStrings.ToArray()) - 1;
            if (activeInitialReflexComportIndex != o)
            {
                c.writeInitialReflexComport       = true;
                intelligenceReflex.defaultComport = activeInitialReflexComportIndex >= 0 ? aiModel.behaviors_reflex[activeInitialReflexComportIndex] : null;
            }
        }
        GUILayout.EndHorizontal();

        if (GUILayout.Button("Export transitions"))
        {
            MindComponent.print(c.TransitionExport);
        }
    }
Example #38
0
 public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks)
 {
     #if UNITY_EDITOR
     triggerID = UnityEditor.EditorGUILayout.TextField("TriggerID:", triggerID);
     #endif
 }
        public void InitializeSummon(Fighter owner, bool summonStats)
        {
            this.Summoned   = true;
            this.SummonerId = owner.Id;


            if (summonStats)
            {
                this.CurrentLifePoints = this.CurrentMaxLifePoints = this.MaxLifePoints = this.LifePoints = FormulasProvider.Instance.GetSummonedCharacteristicDelta(CurrentLifePoints, owner.Level);

                this.Strength.Base = (short)FormulasProvider.Instance.GetSummonedCharacteristicDelta(Strength.Total(), owner.Level);

                this.Agility.Base = (short)FormulasProvider.Instance.GetSummonedCharacteristicDelta(Agility.Total(), owner.Level);

                this.Intelligence.Base = (short)FormulasProvider.Instance.GetSummonedCharacteristicDelta(Intelligence.Total(), owner.Level);

                this.Chance.Base = (short)FormulasProvider.Instance.GetSummonedCharacteristicDelta(Chance.Total(), owner.Level);

                this.Wisdom.Base = (short)FormulasProvider.Instance.GetSummonedCharacteristicDelta(Wisdom.Total(), owner.Level);
            }
        }
Example #40
0
 public virtual void DrawGUI(Intelligence intelligence, CallbackCollection callbacks)
 {
 }