private void GenerateThreatPoints(CChar agent, MTile tile, int dist, bool lTeam)
        {
            var    builder = new ThreatPointBuilder();
            double scalar  = 1;
            double degrade = AgentRoleDegradationTable.Instance.ThreatTable[agent.Proxy.GetAIRole()];

            for (int i = 0; i < dist; i++)
            {
                scalar *= degrade;
            }
            scalar *= this.GetHeightScalar(tile);
            var threats        = builder.BuildThreats(agent);
            var particles      = tile.GetParticles();
            var selfThreatMods = AgentRoleSelfModTable.Instance.ThreatTable[agent.Proxy.GetAIRole()];

            foreach (var kvp in threats)
            {
                kvp.Value.ScaleValue(degrade);
                kvp.Value.ScaleValue(selfThreatMods[kvp.Key]);
                particles.AddThreatParticles(kvp.Key, kvp.Value, lTeam);
            }
        }
Beispiel #2
0
        private void GenerateParticlePoints(EAgentRole role, MTile tile, bool lTeam)
        {
            var    particles      = tile.GetParticles();
            double particlePoints = 0;

            var enemyVulns      = this._vulns.EnemyVulnTable[role];
            var enemyThreats    = this._threats.EnemyThreatTable[role];
            var friendlyVulns   = this._vulns.FriendlyVulnTable[role];
            var friendlyThreats = this._threats.FriendlyThreatTable[role];

            foreach (var kvp in enemyThreats)
            {
                particlePoints -= (particles.GetThreatValue(kvp.Key, lTeam) * kvp.Value);
            }
            foreach (var kvp in enemyVulns)
            {
                double points = (particles.GetVulnValue(kvp.Key, lTeam) * kvp.Value);
                points         *= tile.GetVulnMod();
                particlePoints += points;
            }
            foreach (var kvp in friendlyThreats)
            {
                double points = (particles.GetThreatValue(kvp.Key, lTeam) * kvp.Value);
                points         *= tile.GetThreatMod();
                particlePoints += points;
            }
            foreach (var kvp in friendlyVulns)
            {
                particlePoints += (particles.GetVulnValue(kvp.Key, lTeam) * kvp.Value);
            }
            var tileAndWeight = new AgentMoveTileAndWeight();

            tileAndWeight.Tile   = tile;
            tileAndWeight.Weight = particlePoints;
            this._tiles.Add(tileAndWeight);
        }