public CompanionFighter(CompanionRecord template, CharacterFighter master, FightTeam team)
     : base(team)
 {
     this.Template = template;
     this.Master = master;
     this.Spells = Template.GetSpellItems(Master.Client.Character);
     this.Shortcuts = GenerateShortcuts();
     if (this.Template.StartingSpellLevelId != 0)
     this.AutoCastSpell = SpellLevelRecord.GetLevel(Template.StartingSpellLevelId);
     this.ReadyToFight = true;
 }
Exemple #2
0
 public void Initialize()
 {
     #region Companions
     var item = GetItemByPosition(CharacterInventoryPositionEnum.INVENTORY_POSITION_COMPANION);
     if (item != null)
     {
         var companionEffect = item.GetFirstEffect <ObjectEffectInteger>(EffectsEnum.Eff_Companion);
         Character.EquipedCompanion = CompanionRecord.GetCompanion(companionEffect.value);
     }
     #endregion
 }
Exemple #3
0
 public override SpellLevelRecord GetSpellLevel(ushort spellid)
 {
     if (this.AutoCastSpell == null)
     {
         return(SpellLevelRecord.GetLevel(spellid, CompanionRecord.GetSpellGrade(Master.Client.Character)));
     }
     else
     {
         return(this.AutoCastSpell.SpellId == spellid ? this.AutoCastSpell : SpellLevelRecord.GetLevel(spellid, CompanionRecord.GetSpellGrade(Master.Client.Character)));
     }
 }
Exemple #4
0
 public CompanionFighter(CompanionRecord template, CharacterFighter master, FightTeam team)
     : base(team)
 {
     this.Template  = template;
     this.Master    = master;
     this.Spells    = Template.GetSpellItems(Master.Client.Character);
     this.Shortcuts = GenerateShortcuts();
     if (this.Template.StartingSpellLevelId != 0)
     {
         this.AutoCastSpell = SpellLevelRecord.GetLevel(Template.StartingSpellLevelId);
     }
     this.ReadyToFight = true;
 }
Exemple #5
0
        public void EquipCompanion(short templateid)
        {
            CompanionRecord companion = CompanionRecord.GetCompanion(templateid);

            this.EquipedCompanion = companion;
        }
Exemple #6
0
    public void LoadEffects(BattleGroundSaveData battleSaveData)
    {
        #region Load Statuses and Immobilize
        for (int i = 0; i < HeroParty.Units.Count; i++)
        {
            if (HeroParty.Units[i].Character[StatusType.Stun].IsApplied)
            {
                HeroParty.Units[i].SetHalo("stunned");
            }
            else if (HeroParty.Units[i].CombatInfo.IsSurprised)
            {
                HeroParty.Units[i].SetHalo("surprised");
            }

            if (HeroParty.Units[i].CombatInfo.IsImmobilized)
            {
                HeroParty.Units[i].SetDefendAnimation(true);
            }

            if (HeroParty.Units[i].Character.IsMonster == false)
            {
                var hero = HeroParty.Units[i].Character as Hero;
                if (hero[StatusType.DeathsDoor].IsApplied)
                {
                    hero.ApplyDeathDoor();
                }
                else if (hero[StatusType.DeathRecovery].IsApplied)
                {
                    hero.ApplyMortality();
                }
            }
        }
        for (int i = 0; i < MonsterParty.Units.Count; i++)
        {
            if (MonsterParty.Units[i].Character[StatusType.Stun].IsApplied)
            {
                MonsterParty.Units[i].SetHalo("stunned");
            }
            else if (MonsterParty.Units[i].CombatInfo.IsSurprised)
            {
                MonsterParty.Units[i].SetHalo("surprised");
            }

            if (MonsterParty.Units[i].CombatInfo.IsImmobilized)
            {
                MonsterParty.Units[i].SetDefendAnimation(true);
            }

            if (MonsterParty.Units[i].Character.IsMonster == false)
            {
                MonsterParty.Units[i].SetCombatAnimation(true);
                var hero = MonsterParty.Units[i].Character as Hero;
                if (hero[StatusType.DeathsDoor].IsApplied)
                {
                    hero.ApplyDeathDoor();
                }
                else if (hero[StatusType.DeathRecovery].IsApplied)
                {
                    hero.ApplyMortality();
                }
            }
        }
        #endregion

        #region Load Captures
        for (int i = 0; i < battleSaveData.Captures.Count; i++)
        {
            CaptureRecord newCaptureRecord = new CaptureRecord();
            int           prisonerId       = newCaptureRecord.GetHashPrisonerId(battleSaveData.Captures[i]);
            int           captorId         = newCaptureRecord.GetHashCaptorId(battleSaveData.Captures[i]);
            newCaptureRecord.RemoveFromParty = newCaptureRecord.GetHashRemoveFromParty(battleSaveData.Captures[i]);

            if (newCaptureRecord.RemoveFromParty == false)
            {
                FormationUnit prisoner = FindById(prisonerId);
                FormationUnit captor   = FindById(captorId);
                newCaptureRecord.PrisonerUnit = prisoner;
                newCaptureRecord.CaptorUnit   = captor;
                prisoner.SetCaptureEffect(captor);
                Captures.Add(newCaptureRecord);
            }
            else
            {
                FormationUnit prisoner = loadedRemovedPrisoners.Find(removedUnit => removedUnit.CombatInfo.CombatId == prisonerId);
                FormationUnit captor   = FindById(captorId);
                prisoner.RectTransform.position = captor.RectTransform.position;
                newCaptureRecord.PrisonerUnit   = prisoner;
                newCaptureRecord.CaptorUnit     = captor;
                Captures.Add(newCaptureRecord);
            }
        }
        #endregion

        #region Load Companions
        for (int i = 0; i < battleSaveData.Companions.Count; i++)
        {
            CompanionRecord newCompanionRecord = new CompanionRecord();
            int             companionId        = newCompanionRecord.GetHashCompanionId(battleSaveData.Companions[i]);
            int             targetId           = newCompanionRecord.GetHashTargetId(battleSaveData.Companions[i]);

            FormationUnit companion = FindById(companionId);
            FormationUnit target    = FindById(targetId);
            newCompanionRecord.CompanionUnit = companion;
            newCompanionRecord.TargetUnit    = target;
            Companions.Add(newCompanionRecord);
        }
        #endregion

        #region Load Controls
        for (int i = 0; i < battleSaveData.Controls.Count; i++)
        {
            ControlRecord newControlRecord = new ControlRecord();
            int           prisonerId       = newControlRecord.GetHashPrisonerId(battleSaveData.Controls[i]);
            int           controllerId     = newControlRecord.GetHashControlId(battleSaveData.Controls[i]);
            newControlRecord.DurationLeft = newControlRecord.GetHashDurationLeft(battleSaveData.Controls[i]);
            FormationUnit prisoner   = FindById(prisonerId);
            FormationUnit controller = FindById(controllerId);
            newControlRecord.PrisonerUnit = prisoner;
            newControlRecord.ControllUnit = controller;
            Controls.Add(newControlRecord);
        }
        #endregion

        loadedRemovedPrisoners.Clear();

        RaidSceneManager.Formations.HeroOverlay.UpdateOverlay();
        RaidSceneManager.Formations.monsters.overlay.UpdateOverlay();
    }