示例#1
0
        protected Character SpawnBase(Team team, IMobSpawnMap map)
        {
            MonsterID   formData = BaseForm;
            MonsterData dex      = DataManager.Instance.GetMonster(formData.Species);

            if (formData.Form == -1)
            {
                int form = map.Rand.Next(dex.Forms.Count);
                formData.Form = form;
            }

            BaseMonsterForm formEntry = dex.Forms[formData.Form];

            if (formData.Gender == Gender.Unknown)
            {
                formData.Gender = formEntry.RollGender(map.Rand);
            }

            if (formData.Skin == -1)
            {
                formData.Skin = formEntry.RollSkin(map.Rand);
            }

            CharData character = new CharData();

            character.BaseForm = formData;
            character.Level    = Level.Pick(map.Rand);

            List <int> final_skills = formEntry.RollLatestSkills(character.Level, SpecifiedSkills);

            for (int ii = 0; ii < final_skills.Count; ii++)
            {
                character.BaseSkills[ii] = new SlotSkill(final_skills[ii]);
            }

            if (Intrinsic == -1)
            {
                character.BaseIntrinsics[0] = formEntry.RollIntrinsic(map.Rand, 2);
            }
            else
            {
                character.BaseIntrinsics[0] = Intrinsic;
            }

            character.Discriminator = map.Rand.Next();

            Character new_mob = new Character(character, team);

            team.Players.Add(new_mob);

            return(new_mob);
        }
示例#2
0
        public Character CreatePlayer(ReRandom rand, MonsterID form, int level, int intrinsic, int personality)
        {
            MonsterID   formData = form;
            MonsterData dex      = DataManager.Instance.GetMonster(formData.Species);

            CharData character = new CharData();

            character.BaseForm = formData;
            character.Level    = level;

            BaseMonsterForm formEntry = dex.Forms[formData.Form];

            List <int> final_skills = formEntry.RollLatestSkills(character.Level, new List <int>());

            for (int ii = 0; ii < final_skills.Count; ii++)
            {
                character.BaseSkills[ii] = new SlotSkill(final_skills[ii]);
            }

            if (form.Gender == Gender.Unknown)
            {
                character.BaseForm.Gender = dex.Forms[formData.Form].RollGender(rand);
            }

            if (intrinsic == -1)
            {
                character.BaseIntrinsics[0] = formEntry.RollIntrinsic(rand, 2);
            }
            else
            {
                character.BaseIntrinsics[0] = intrinsic;
            }

            if (personality == -1)
            {
                character.Discriminator = rand.Next();
            }
            else
            {
                character.Discriminator = personality;
            }


            character.OriginalUUID = DataManager.Instance.Save.UUID;
            character.OriginalTeam = DataManager.Instance.Save.ActiveTeam.Name;
            character.MetAt        = Text.FormatKey("MET_AT_START");

            return(CreatePlayer(character));
        }
示例#3
0
        public override void OnPromote(Character character)
        {
            ExplorerTeam team = character.MemberTeam as ExplorerTeam;

            if (team == null)
            {
                return;
            }
            if (character.MemberTeam.Players.Count == team.GetMaxTeam(ZoneManager.Instance.CurrentZone))
            {
                return;
            }

            //if character has an open team slot, spawn the new character based on the stats of the current one

            MonsterID   formData = new MonsterID(ShedSpecies, 0, character.BaseForm.Skin, Gender.Genderless);
            MonsterData dex      = DataManager.Instance.GetMonster(formData.Species);

            CharData newChar = new CharData();

            newChar.BaseForm = formData;
            newChar.Level    = character.Level;

            newChar.MaxHPBonus = character.MaxHPBonus;
            newChar.AtkBonus   = character.AtkBonus;
            newChar.DefBonus   = character.DefBonus;
            newChar.MAtkBonus  = character.MAtkBonus;
            newChar.MDefBonus  = character.MDefBonus;
            newChar.SpeedBonus = character.SpeedBonus;

            BaseMonsterForm forme = dex.Forms[formData.Form];

            for (int ii = 0; ii < character.BaseSkills.Count; ii++)
            {
                newChar.BaseSkills[ii] = new SlotSkill(character.BaseSkills[ii]);
            }

            newChar.BaseIntrinsics[0] = forme.RollIntrinsic(DataManager.Instance.Save.Rand, 2);

            newChar.Discriminator = character.Discriminator;
            newChar.MetAt         = character.MetAt;
            newChar.MetLoc        = character.MetLoc;
            foreach (BattleEvent effect in character.ActionEvents)
            {
                newChar.ActionEvents.Add((BattleEvent)effect.Clone());
            }

            Character player = new Character(newChar, character.MemberTeam);

            foreach (BackReference <Skill> move in player.Skills)
            {
                if (move.Element.SkillNum > -1)
                {
                    SkillData entry = DataManager.Instance.GetSkill(move.Element.SkillNum);
                    move.Element.Enabled = (entry.Data.Category == BattleData.SkillCategory.Physical || entry.Data.Category == BattleData.SkillCategory.Magical);
                }
            }
            player.Tactic = new AITactic(character.Tactic);
            character.MemberTeam.Players.Add(player);

            Loc?endLoc = ZoneManager.Instance.CurrentMap.GetClosestTileForChar(player, character.CharLoc);

            if (endLoc == null)
            {
                endLoc = character.CharLoc;
            }

            player.CharLoc = endLoc.Value;

            ZoneManager.Instance.CurrentMap.UpdateExploration(player);

            player.RefreshTraits();

            DataManager.Instance.Save.RegisterMonster(newChar.BaseForm.Species);
            DataManager.Instance.Save.RogueUnlockMonster(newChar.BaseForm.Species);
        }