Пример #1
0
 public TargetDto(NPC target, ParsedLog log, bool cr, ActorDetailsDto details)
 {
     Name     = target.Character;
     Icon     = GeneralHelper.GetIcon(target);
     Health   = target.GetHealth(log.CombatData);
     HbHeight = target.HitboxHeight;
     HbWidth  = target.HitboxWidth;
     Tough    = target.Toughness;
     Details  = details;
     if (cr)
     {
         CombatReplayID = target.GetCombatReplayID(log);
     }
     if (log.FightData.Success)
     {
         HpLeft = 0;
     }
     else
     {
         List <HealthUpdateEvent> hpUpdates = log.CombatData.GetHealthUpdateEvents(target.AgentItem);
         if (hpUpdates.Count > 0)
         {
             HpLeft = hpUpdates.Last().HPPercent;
         }
     }
     Percent = Math.Round(100.0 - HpLeft, 2);
     foreach (KeyValuePair <long, Minions> pair in target.GetMinions(log))
     {
         Minions.Add(new MinionDto()
         {
             Id = pair.Key, Name = pair.Value.Character
         });
     }
 }
Пример #2
0
 public PlayerDto(Player player, ParsedLog log, bool cr, ActorDetailsDto details)
 {
     Group      = player.Group;
     Name       = player.Character;
     Acc        = player.Account;
     Profession = player.Prof;
     Condi      = player.Condition;
     Conc       = player.Concentration;
     Heal       = player.Healing;
     Tough      = player.Toughness;
     ColTarget  = GeneralHelper.GetLink("Color-" + player.Prof);
     ColCleave  = GeneralHelper.GetLink("Color-" + player.Prof + "-NonBoss");
     ColTotal   = GeneralHelper.GetLink("Color-" + player.Prof + "-Total");
     IsConjure  = (player.IsFakeActor);
     BuildWeaponSets(player, log);
     Details = details;
     if (cr && !IsConjure)
     {
         CombatReplayID = player.GetCombatReplayID(log);
     }
     foreach (KeyValuePair <long, Minions> pair in player.GetMinions(log))
     {
         Minions.Add(new MinionDto()
         {
             Id   = pair.Key,
             Name = pair.Value.Character
         });
     }
 }
Пример #3
0
        public List <Body> GenerateRandomSpawn(int numCreatures, Vector3 position)
        {
            if (Race.CreatureTypes.Count == 0)
            {
                return(new List <Body>());
            }

            List <Body> toReturn = new List <Body>();

            for (int i = 0; i < numCreatures; i++)
            {
                string  creature = Race.CreatureTypes[MathFunctions.Random.Next(Race.CreatureTypes.Count)];
                Vector3 offset   = MathFunctions.RandVector3Cube() * 5;
                Voxel   voxel    = new Voxel();

                if (World.ChunkManager.ChunkData.GetFirstVoxelUnder(position + offset, ref voxel, true))
                {
                    Body       body = EntityFactory.CreateEntity <Body>(creature, position + offset);
                    CreatureAI ai   = body.GetChildrenOfType <CreatureAI>().FirstOrDefault();

                    if (ai != null)
                    {
                        ai.Faction.Minions.Remove(ai);

                        Minions.Add(ai);
                        ai.Faction         = this;
                        ai.Creature.Allies = Name;
                    }

                    toReturn.Add(body);
                }
            }

            return(toReturn);
        }
        public void Add(Type type)
        {
            Type pretype = type;
            Type parent  = type;

            while (parent.BaseType != typeof(object))
            {
                pretype = parent;
                parent  = parent.BaseType;
            }

            if (parent == typeof(Card))
            {
                if (pretype == typeof(Spell))
                {
                    Spells.Add(type);
                    Registry.Spells.Reg(type);
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
            else if (parent == typeof(Creature))
            {
                if (pretype == typeof(Minion))
                {
                    Minions.Add(type);
                    Registry.Minions.Reg(type);
                }
                else if (pretype == typeof(Hero))
                {
                    Heroes.Add(type);
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
            else if (parent == typeof(RandomEvent))
            {
                RandomEvents.Add(type);
                Registry.RandomEvents.Reg(type);
            }
            else if (parent == typeof(Player))
            {
                Players.Add(type);
            }
            else if (parent == typeof(Hero.HeroPower))
            {
            }
            else
            {
                throw new NotImplementedException();
            }
        }
 protected ActorDto(AbstractSingleActor actor, ParsedEvtcLog log, ActorDetailsDto details)
 {
     Name     = actor.Character;
     Tough    = actor.Toughness;
     Details  = details;
     UniqueID = actor.UniqueID;
     foreach (KeyValuePair <long, Minions> pair in actor.GetMinions(log))
     {
         Minions.Add(new MinionDto()
         {
             Id   = pair.Key,
             Name = pair.Value.Character
         });
     }
 }
Пример #6
0
        public void AddMinion(CreatureAI minion)
        {
            Minions.Add(minion);
            Inventory targetInventory = minion.GetRoot().GetComponent <Inventory>();

            if (targetInventory != null)
            {
                targetInventory.OnDeath += resources =>
                {
                    if (resources == null)
                    {
                        return;
                    }
                    AssignGather(resources);
                };
            }
        }
Пример #7
0
 protected ActorDto(AbstractSingleActor actor, ParsedLog log, bool cr, ActorDetailsDto details)
 {
     Name    = actor.Character;
     Tough   = actor.Toughness;
     Details = details;
     if (cr)
     {
         CombatReplayID = actor.CombatReplayID;
     }
     foreach (KeyValuePair <long, Minions> pair in actor.GetMinions(log))
     {
         Minions.Add(new MinionDto()
         {
             Id   = pair.Key,
             Name = pair.Value.Character
         });
     }
 }
Пример #8
0
 protected ActorDto(AbstractSingleActor actor, ParsedEvtcLog log, ActorDetailsDto details)
 {
     Health   = actor.GetHealth(log.CombatData);
     Condi    = actor.Condition;
     Conc     = actor.Concentration;
     Heal     = actor.Healing;
     Icon     = actor.GetIcon();
     Name     = actor.Character;
     Tough    = actor.Toughness;
     Details  = details;
     UniqueID = actor.UniqueID;
     foreach (KeyValuePair <long, Minions> pair in actor.GetMinions(log))
     {
         Minions.Add(new MinionDto()
         {
             Id   = pair.Key,
             Name = pair.Value.Character
         });
     }
 }
Пример #9
0
        public List <Body> GenerateRandomSpawn(int numCreatures, Vector3 position)
        {
            if (Race.CreatureTypes.Count == 0)
            {
                return(new List <Body>());
            }

            List <Body> toReturn = new List <Body>();

            for (int i = 0; i < numCreatures; i++)
            {
                string  creature = Race.CreatureTypes[MathFunctions.Random.Next(Race.CreatureTypes.Count)];
                Vector3 offset   = MathFunctions.RandVector3Cube() * 2;

                var voxelUnder = VoxelHelpers.FindFirstVoxelBelowIncludeWater(new VoxelHandle(
                                                                                  World.ChunkManager.ChunkData, GlobalVoxelCoordinate.FromVector3(position + offset)));
                if (voxelUnder.IsValid)
                {
                    var body = EntityFactory.CreateEntity <Body>(creature, voxelUnder.WorldPosition + new Vector3(0.5f, 1, 0.5f));
                    var ai   = body.EnumerateAll().OfType <CreatureAI>().FirstOrDefault();

                    if (ai != null)
                    {
                        ai.Faction.Minions.Remove(ai);

                        Minions.Add(ai);
                        ai.Faction         = this;
                        ai.Creature.Allies = Name;
                    }

                    toReturn.Add(body);
                }
            }

            return(toReturn);
        }
Пример #10
0
 public void AddMinion(CreatureAI minion)
 {
     Minions.Add(minion);
 }