예제 #1
0
 // Token: 0x06003788 RID: 14216 RVA: 0x000F9B94 File Offset: 0x000F7D94
 public void Start(BattleActor actor0, BattleActor actor1, ConfigDataSkillInfo heroSkillInfo0, ConfigDataSkillInfo heroSkillInfo1, int randomSeed)
 {
     if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_StartBattleActorBattleActorConfigDataSkillInfoConfigDataSkillInfoInt32_hotfix != null)
     {
         this.m_StartBattleActorBattleActorConfigDataSkillInfoConfigDataSkillInfoInt32_hotfix.call(new object[]
         {
             this,
             actor0,
             actor1,
             heroSkillInfo0,
             heroSkillInfo1,
             randomSeed
         });
         return;
     }
     BJLuaObjHelper.IsSkipLuaHotfix = false;
     this.Clear();
     this.m_randomNumber.SetSeed(randomSeed);
     this.m_startCountdown     = Combat.MillisecondToFrame1(this.ConfigDataLoader.UtilityGetConfigableConst(ConfigableConstId.ConfigableConstId_Combat_StartDelay) + 250) + 1;
     this.m_state              = CombatState.Ready;
     this.m_isPaused           = false;
     this.m_combatGridDistance = GridPosition.Distance(actor0.Position, actor1.Position);
     this.SetupTeam(0, actor0, heroSkillInfo0);
     this.SetupTeam(1, actor1, heroSkillInfo1);
     foreach (CombatTeam combatTeam in this.m_teams)
     {
         combatTeam.EnterCombat();
     }
 }
예제 #2
0
    BattleActor GetActor(OrderStatus isIn, int instId, COM_BattleEntityInformation babyInst)
    {
        BattleActor baby = GamePlayer.Instance.FindBabyBattleActor(instId);

        if (isIn_.Equals(OrderStatus.OS_ShouBaobao))
        {
            //如果是自己的宝宝
            if (baby != null)
            {
                //改出站状态
                GamePlayer.Instance.BabyState(instId, false);
            }
            return(Battle.Instance.GetActorByInstId(instId));
        }
        else
        {
            //如果是自己的宝宝
            if (baby != null)
            {
                pairPosition_  = Battle.Instance.GetPairPos(player_.BattlePos);
                baby.BattlePos = pairPosition_;
            }
            else //别人的宝宝
            {
                baby = new BattleActor();
                baby.SetBattlePlayer(babyInst);
                pairPosition_ = (int)babyInst.battlePosition_;
            }

            return(baby);
        }
    }
예제 #3
0
    private void OnClickRecycle(ButtonScript obj, object args, int param1, int param2)
    {
        if (GamePlayer.Instance.BattleBaby == null)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("NoBabyRecall"));
            return;
        }

        if (AttaclEvent.getInstance.BabyEvent != null)
        {
            AttaclEvent.getInstance.BabyEvent(GamePlayer.Instance.BattleBaby.InstId);
        }

        BattleActor babyInBattle = Battle.Instance.GetActorByInstId(GamePlayer.Instance.BattleBaby.InstId);

        if (babyInBattle.isDead == false)
        {
            Baby baby = new Baby();
            baby.Resize();
            baby.InstId = babyInBattle.InstId;
            baby.SetIprop(PropertyType.PT_TableId, babyInBattle.battlePlayer.tableId_);
            baby.SetIprop(PropertyType.PT_Level, babyInBattle.battlePlayer.level_);
            baby.SetIprop(PropertyType.PT_HpCurr, babyInBattle.battlePlayer.hpCrt_);
            baby.SetIprop(PropertyType.PT_MpCurr, babyInBattle.battlePlayer.mpCrt_);
            baby.SetIprop(PropertyType.PT_HpMax, babyInBattle.battlePlayer.hpMax_);
            baby.SetIprop(PropertyType.PT_MpMax, babyInBattle.battlePlayer.mpMax_);
            displayList_.Add(baby);
        }

        AttaclPanel.Instance.CloseBabyWindow();
    }
예제 #4
0
        // Token: 0x060036F4 RID: 14068 RVA: 0x000F4638 File Offset: 0x000F2838
        public void SetActor(GridPosition p, BattleActor actor)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_SetActorGridPositionBattleActor_hotfix != null)
            {
                this.m_SetActorGridPositionBattleActor_hotfix.call(new object[]
                {
                    this,
                    p,
                    actor
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            BattleMapCell cell = this.GetCell(p);

            if (cell == null)
            {
                return;
            }
            if (actor != null && cell.m_actor != null)
            {
                DebugUtility.LogError(string.Format("BattleMap.SetActor() error, {0} already has actor {1}", p, cell.m_actor.Id));
            }
            cell.m_actor = actor;
        }
예제 #5
0
        private void Render(BattleActor BA1, BattleActor BA2)
        {
            Console.Clear();
            Terminal.WriteLine($"|", '-');

            Terminal.WriteLine($"| {BA1.Name.PadRight(15, ' ')}{BA1.Health}/{BA1.HealthMax}");
            if (BA1.CurrentWeapon != null)
            {
                Terminal.WriteLine($"| {BA1.CurrentWeapon.Name.PadRight(15, ' ')}Eff:{BA1.CurrentWeapon.Effectiveness} Def:{BA1.CurrentWeapon.Defense} - Wait:{BA1.Wait} - {BA1.CurrentWeapon.PropertySummary}");
            }
            else // Pad out.
            {
                Terminal.WriteLine($"|");
            }

            Terminal.WriteLine($"|");

            Terminal.WriteLine($"| {BA2.Name.PadRight(15, ' ')}{BA2.Health}/{BA2.HealthMax}");
            if (BA2.CurrentWeapon != null)
            {
                Terminal.WriteLine($"| {BA2.CurrentWeapon.Name.PadRight(15, ' ')}Eff:{BA2.CurrentWeapon.Effectiveness} Def:{BA2.CurrentWeapon.Defense} - Wait:{BA2.Wait} - {BA2.CurrentWeapon.PropertySummary}");
            }
            else // Pad out.
            {
                Terminal.WriteLine($"|");
            }

            Terminal.WriteLine($"|", '-');
        }
예제 #6
0
    void Next()
    {
        bool adding = false;

        while (addWarriors_index + 1 < GameData.CurrentBattle.CurrentPlayer.AvailableActors.Count)
        {
            addWarriors_index++;
            adding = true;
            BattleObject obj = GameData.CurrentBattle.CurrentPlayer.AvailableActors[addWarriors_index];
            if (!(obj is BattleActor))
            {
                continue;
            }

            BattleActor actor = obj as BattleActor;
            BattleSceneController.Main.HeadsupText.text = "Place " + GameData.CurrentBattle.CurrentPlayer.Name + "'s " + actor.Type.Name;
            break;
        }

        if (!adding && addWarriors_index + 1 >= GameData.CurrentBattle.CurrentPlayer.AvailableActors.Count)
        {
            addedPlayers++;
            if (addedPlayers == 2)
            {
                BattleSceneController.Main.SwitchFlow(FlowState.ChooseActorToPerform);
            }
            else
            {
                GameData.CurrentBattle.CurrentPlayer = GameData.CurrentBattle.CurrentPlayer.GetEnemy();
                BattleSceneController.Main.SwitchFlow(FlowState.AddingWarriors);
            }
        }
    }
예제 #7
0
    void Attack(BattleActor actor)
    {
        BattleSceneController.Main.PerformMenu.Deactivate();
        BattleSceneController.Main.SelectedActor = actor;

        BattleSceneController.Main.SwitchFlow(FlowState.PerformAttackLocation);
    }
예제 #8
0
    public static int GetAttackID(BattleActor actor)
    {
        WeaponType wt     = WeaponType.WT_None;
        ItemData   weapon = ItemData.GetData(actor.battlePlayer.weaponItemId_);

        if (weapon != null)
        {
            wt = weapon.weaponType_;
        }
        switch (wt)
        {
        case WeaponType.WT_None:
            return(GetAttackID((JobType)actor.battlePlayer.jt_));

        case WeaponType.WT_Axe:
        case WeaponType.WT_Sword:
        case WeaponType.WT_Stick:
            return(8);

        case WeaponType.WT_Spear:
            return(9);

        case WeaponType.WT_Bow:
            return(10);

        case WeaponType.WT_Knife:
            //case WeaponType.WT_V:
            return(11);

        default:
            return(1);
        }
    }
예제 #9
0
    public void UpdateWeaponOutLook(int itemId, UpdateWeaponHandler callback = null)
    {
        updateWeaponCallBack_ = callback;
        if (itemId == 0)
        {
            if (weaponAssetBundle_ != null)
            {
                AssetInfoMgr.Instance.DecRefCount(weaponAssetBundle_, false);
            }
            if (updateWeaponCallBack_ != null)
            {
                updateWeaponCallBack_();
                updateWeaponCallBack_ = null;
            }
            return;
        }
        BattleActor actor      = Battle.Instance.GetActorByInstId(PlayerID);
        string      weaponName = EntityAssetsData.GetData(ItemData.GetData(itemId).weaponEntityId_).assetsName_;
        string      resPath    = string.Format("{0}_{1}", actor.AssetId, weaponName);
        ItemData    weapon     = ItemData.GetData(itemId);

        AssetLoader.LoadAssetBundle(resPath, AssetLoader.EAssetType.ASSET_WEAPON, (AssetBundle asset, ParamData data) => {
            if (weaponAssetBundle_ != null)
            {
                AssetInfoMgr.Instance.DecRefCount(weaponAssetBundle_, false);
            }
            WeaponObj = (GameObject)GameObject.Instantiate(asset.mainAsset) as GameObject;
            WeaponObj.transform.parent = m_EntityObj.transform.FindChild(EntityAssetsData.GetData(weapon.weaponEntityId_).bindPoint_);
            if (updateWeaponCallBack_ != null)
            {
                updateWeaponCallBack_();
                updateWeaponCallBack_ = null;
            }
        }, null);
    }
예제 #10
0
 public bool canCast(BattleActor actor)
 {
     foreach (string requirement in requirements)
     {
         if (requirement.StartsWith("weapon:"))
         {
             if (!actor.hasEquipmentType(requirement.Substring(7, requirement.Length - 7)))
             {
                 return(false);
             }
         }
         if (requirement.StartsWith("keyword:"))
         {
             if (!actor.hasKeyword(requirement.Substring(8, requirement.Length - 8)))
             {
                 return(false);
             }
         }
         if (requirement.StartsWith("stat:"))
         {
             if (actor.getStat(requirement.Split(':') [1]) < int.Parse(requirement.Split(':') [2]))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
예제 #11
0
    void DealCounterAction(BattleActor aim)
    {
        // reset action state
        aim.ControlEntity.ResetState();
        COM_ReportActionCounter counter = GetAimCounter(aim.BattlePos);

        if (counter == null)
        {
//			if(counterLst_.Count == 0)
//			{
            mainSkillInst.ContinueAttack();
            return;
//			}
        }

        BattleActor actor = null;

        if (counter.states_ != null)
        {
            for (int i = 0; i < counter.states_.Length; ++i)
            {
                // add counter state
                actor = Battle.Instance.GetActorByInstId(counter.states_[i].ownerId_);
                actor.ControlEntity.AddState(counter.states_[i]);
            }
        }

        ExcuteState(StateInst.ExcuteType.ET_Beattack, ExcuteCounter, counter, true);
    }
예제 #12
0
    public static bool CanMoveAndAttack(BattleActor actor, BattleObject target, out Vector2 movePattern, out Vector2 attackPattern)
    {
        List <Vector2> moveLocations = actor.Type.Pattern.GetLocationsForFlags(PatternFlags.Movement);

        moveLocations.Add(Vector2.zero);

        List <Vector2> attackLocations = actor.Type.Pattern.GetLocationsForFlags(PatternFlags.Attack);
        Vector2        actorPos        = actor.Position;
        Vector2        targetPos       = target.Position;

        foreach (Vector2 movePos in moveLocations)
        {
            foreach (Vector2 attackPos in attackLocations)
            {
                if (movePos + attackPos + actorPos == targetPos &&
                    actor.CanMoveTo(actor.Position + movePos))
                {
                    movePattern   = movePos;
                    attackPattern = attackPos;
                    return(true);
                }
            }
        }

        movePattern   = Vector2.zero;
        attackPattern = Vector2.zero;
        return(false);
    }
예제 #13
0
 // Token: 0x0600347C RID: 13436 RVA: 0x000DF320 File Offset: 0x000DD520
 public BuffState(int id, ConfigDataBuffInfo buffInfo, BattleActor applyer, BuffSourceType sourceType, ConfigDataSkillInfo sourceSkillInfo)
 {
     this.m_id              = id;
     this.m_buffInfo        = buffInfo;
     this.m_time            = buffInfo.Time;
     this.m_applyer         = applyer;
     this.m_sourceType      = sourceType;
     this.m_sourceSkillInfo = sourceSkillInfo;
     this.m_parent          = null;
     this.m_hasExtraTime    = false;
     this.m_effectTimes     = 0;
     if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_ctorInt32ConfigDataBuffInfoBattleActorBuffSourceTypeConfigDataSkillInfo_hotfix != null)
     {
         this.m_ctorInt32ConfigDataBuffInfoBattleActorBuffSourceTypeConfigDataSkillInfo_hotfix.call(new object[]
         {
             this,
             id,
             buffInfo,
             applyer,
             sourceType,
             sourceSkillInfo
         });
         return;
     }
     BJLuaObjHelper.IsSkipLuaHotfix = false;
 }
예제 #14
0
 private void SetOpponentFirst()
 {
     FirstSide   = OpponentSide;
     FirstActor  = OpponentActor;
     SecondSide  = PlayerSide;
     SecondActor = PlayerActor;
 }
예제 #15
0
        private void PromptWeapon(BattleActor actor)
        {
            char   response = ' ';
            Weapon weapon   = null;

            Terminal.WriteLine($"| Select Weapon: ", '-');

            // Display offering of weapons.
            for (int i = 0; i < Actor.MaxWeaponCount; ++i)
            {
                weapon = PartyA[0].Weapons[i];
                if (weapon != null)
                {
                    Console.Write($"| {i} - {weapon.Name.PadRight(11, ' ')}");
                    Console.Write($" Eff:{$"{weapon.Effectiveness}".PadRight(4, ' ')}");
                    Console.Write($" Def:{$"{weapon.Defense}".PadRight(4, ' ')}");
                    Console.Write($" Speed:{$"{weapon.Speed}".PadRight(4, ' ')}");
                    Console.Write($" {weapon.PropertySummary}");
                    Terminal.WriteLine();
                }
            }

            do // Input loop.
            {
                var cursor = new Point(Console.CursorLeft, Console.CursorTop);
                response = Console.ReadKey().KeyChar;
                Console.SetCursorPosition(cursor.X, cursor.Y);

                response = (response >= '0' && response <= '7') ? response : ' ';
                weapon   = (int.TryParse(response.ToString(), out int index)) ? PartyA[0].Weapons[index] : null;
            } while (weapon == null);

            actor.Select(weapon);
        }
예제 #16
0
 public void DisplayNumberOfAttacks(BattleActor actor, bool isShow, int num)
 {
     if (actor != null && actor.ControlEntity != null && actor.ControlEntity.PlayerInfoUI != null)
     {
         actor.ControlEntity.PlayerInfoUI.GetComponent <Roleui>().DisplayNumberOfAttacks(isShow, num);
     }
 }
예제 #17
0
    public void Attack(ActionCallBack.AttackFinishCallBack FinishCallBack = null,
                       ActionCallBack.PlayBeAttackOneStep hit_1           = null,
                       ActionCallBack.PlayBeAttackTwoStep hit_2           = null,
                       ActionCallBack.PlayBeAttackEffect eff         = null,
                       ActionCallBack.ShowChangePlayerInfo changeVal = null)
    {
        if (null == ActorObj)
        {
            return;
        }
//		PlayEntityAction( GlobalValue.ActionName , GlobalValue.Action_Attack );
        BattleActor self = Battle.Instance.GetActorByInstId(PlayerID);

        if (self == null)
        {
            return;
        }

        SetAnimationParam(self.attackAnim_, AnimatorParamType.APT_Trigger);
        ActionCallBack callback = ActorObj.GetComponent <ActionCallBack>();

        if (null == callback)
        {
            return;
        }
        callback.AttackFinish           = FinishCallBack;
        callback.m_PlayBeAttackOneStep  = hit_1;
        callback.m_PlayBeAttackTwoStep  = hit_2;
        callback.m_PlayBeAttackEffect   = eff;
        callback.m_ShowChangePlayerInfo = changeVal;
        hasActionCallBackToCall         = true;
    }
예제 #18
0
 public void resolveStatus(BattleActor actor, string trig)
 {
     //Debug.Log("TRIGGER TESTING: " + trig + " - " + trigger);
     string[] conditions = condition.Split(' ');
     foreach (string _condition in conditions)
     {
         if (_condition.StartsWith("KEYWORD:"))
         {
             if (!ifTargetHasKeyword(_condition.Substring(7), actor))
             {
                 return;
             }
         }
     }
     if (trigger.Equals(trig) || trig.Equals("none") && trigger.Equals("once"))
     {
         foreach (int eff in effects)
         {
             Database.Effects().getEffectAtIndex(eff).resolveEffect(actor);
         }
     }
     if (trig.Equals("none") && trigger.Equals("once"))
     {
         actor.queueRemoveStatus(this);
     }
 }
    //A coroutine that handles the real time portion of the battle mechanics
    IEnumerator LineProcessing()
    {
        //Before each loop we check if the battle is over
        while (!IsBattleOver())
        {
            //If the line is empty, we wait until someone joins
            while (line.Count == 0)
            {
                yield return(null);
            }

            //Set the controlling boolean to true
            currentGoing = true;

            //Pop the first one in line
            current = line[0];
            line.RemoveAt(0);
            //Tell the popped unit to go
            current.Act();

            //Wait for the current to be done
            while (currentGoing)
            {
                yield return(null);
            }
        }

        //Once we escape the above loop, the battle is over
        BattleEnded();
    }
예제 #20
0
    void ShowHitEffect(int idx)
    {
        if (idx == -1)
        {
            return;
        }

        BattleActor aim = isMelee_? aim_: aims_[idx];

        if (aim == null)
        {
            return;
        }

        bool playSkillEffect = aim.ControlEntity.PlaySkillBeattackEffect(crt_data_._Id);

        if (playSkillEffect)
        {
            EffectAPI.Play((EFFECT_ID)crt_data_._Beattack_effectID, aim.ControlEntity.ActorObj, null, null, null, (EffectInst ei, ParamData data) =>
            {
                if (aim == null || aim.ControlEntity == null || aim.ControlEntity.ActorObj == null)
                {
                    return;
                }
                ei.transform.parent     = aim.ControlEntity.ActorObj.transform;
                ei.transform.localScale = Vector3.one;
            });
        }
        else
        {
            aim.ControlEntity.UpdateStateTick(crt_data_._IsPhysic);
        }
    }
예제 #21
0
    public void ChangePos(int pos1, int pos2, ChangePositionCallBack callback = null, float inTime = 1f)
    {
        a1_       = Battle.Instance.GetActorByIdx(pos1);
        a2_       = Battle.Instance.GetActorByIdx(pos2);
        callback_ = callback;

        if (a2_ == null)
        {
            callbacknum = 1;
            Transform t1 = Battle.Instance.GetStagePointByIndex(pos2);
            a1_.ControlEntity.MoveTo(t1.gameObject, MoveFinish, false);
            if (a1_.ControlEntity.PlayerInfoUI != null)
            {
                a1_.ControlEntity.PlayerInfoUI.transform.position = t1.position;
            }
            a1_.BattlePos = pos2;
        }
        else
        {
            callbacknum = 2;
            int tpos = a1_.BattlePos;
            a1_.BattlePos = a2_.BattlePos;
            a2_.BattlePos = (byte)tpos;
            if (a1_.ControlEntity.PlayerInfoUI != null)
            {
                Vector3 tui = a1_.ControlEntity.PlayerInfoUI.transform.position;
                a1_.ControlEntity.PlayerInfoUI.transform.position = a2_.ControlEntity.PlayerInfoUI.transform.position;
                a2_.ControlEntity.PlayerInfoUI.transform.position = tui;
            }

            // play animation
            a1_.ControlEntity.MoveTo(a2_.ControlEntity.ActorObj, MoveFinish, false, !a1_.isDead);
            a2_.ControlEntity.MoveTo(a1_.ControlEntity.ActorObj, MoveFinish, false, !a2_.isDead);
        }
    }
예제 #22
0
 public void useItem(BattleActor target)
 {
     foreach (Effect effect in useEffects)
     {
         effect.resolveEffect(target);
     }
 }
예제 #23
0
    public override float Execute(Skill skill)
    {
        actor = skill.actor;

        actor.GetGameObject().transform.DOLocalMove(new Vector3(0f, 0f, 0f), duration); // may need to do a local position target

        return(duration);
    }
예제 #24
0
 public void resolveStatus(BattleActor actor)
 {
     Debug.Log("RESOLVE STATUS: EQUIP" + effects.Count);
     foreach (Status stateff in effects)
     {
         stateff.resolveStatus(actor, "Equipment");
     }
 }
예제 #25
0
    public override void Apply(BattleActor actor)
    {
        Debug.Log("Applying " + Name + " to " + actor.Name);

        /*if (actor is HeroActor) {
         *  ((HeroActor) actor).TurnDelay = this;
         * }*/
    }
예제 #26
0
    public Player createPlayer(string username, BattleActor actor)
    {
        Player player = new Player();

        player.setUsername(username);
        player.setBattleActor(actor);
        return(player);
    }
예제 #27
0
 public void resolveEffect(BattleActor caster, BattleActor target)
 {
     if (!modifyStatFormula.Equals(""))
     {
         Debug.Log("MODIFYING STAT " + modifyStat + " WITH FORMULA " + modifyStatFormula);
         target.modifyStat(modifyStat, Database.Formula().damageParse(caster, target, modifyStatFormula));
     }
 }
예제 #28
0
    public void CreateMaskInBattle(int battlePos, float offsetX, float offsetY, GuidePointerRotateType rotateType, string str, int step, bool mask = false, float alpha = 0.7f)
    {
        IsGuiding_ = true;
        BattleActor actor = Battle.Instance.GetActorByIdx(battlePos);

        creator_.CreateInScene(actor.ControlEntity.ActorObj, offsetX, offsetY, rotateType, str, step, alpha, mask);
        crtGuideType_ = GuideType.GT_Scene;
    }
    // 初始化战斗数据库
    private void initializeBattleObjects()
    {
        BattleSkill.InitializeBattleSkills();
        BattleStatus.InitializeBattleStatusList();

        BattleJob.InitializeBattleJobList();
        BattleActor.InitializeBattleActorList();
    }
예제 #30
0
    void TurnAround(BattleActor actor)
    {
        BattleSceneController.Main.PerformMenu.Deactivate();
        BattleSceneController.Main.SelectedActor = actor;
        BattleSceneController.Main.PerformedTurn = true;

        actor.SetInverted(!actor.Inverted);
    }
예제 #31
0
    void Start () 
    {
        //Setup a Party and Monster Lib so i can build/test this battle system
        InitialSimSetup();
        
        charActors = new BattleActor[partySim.Length];
        monstarActors = new BattleActor[monLibSim.Length];
		int idAssign = 0;
        for(int i = 0; i < charActors.Length; i++)
        {
            charActors[i] = new BattleActor(partySim[i], BattleActor.ActorType.Character);
			charActors[i].id = idAssign;
			idAssign++;
        }
        for(int i = 0; i < monstarActors.Length; i++)
        {
            monstarActors[i] = new BattleActor(monLibSim[i], BattleActor.ActorType.Monstar);
			monstarActors[i].id = idAssign;
			idAssign++;
        }
	}
예제 #32
0
 public void DoBasicAttack(BattleActor sender, BattleActor receiver)
 {
     Action a;
     a.actionValue = sender.actor.GetStat("Attack").GetValue();
     a.type = Skill.SkillType.Physical;
     a.element = sender.actor.GetItemInEquipmentSlot("Weapon").element;
     
     ActionInfo aInfo = ActionCalculation(a, sender, receiver);
     actionQueue.Add(aInfo);
 }
예제 #33
0
    public void DoDefense(BattleActor actor)
    {
        //actor.isDefending = true;
		ActionInfo aInfo = new ActionInfo();
		aInfo.isDefending = true;
		aInfo.receiver = actor;
		actionQueue.Add (aInfo);
    }
예제 #34
0
 public void DoSkill(Skill skill, BattleActor sender, BattleActor receiver)
 {
     sender.GetStat("MP").baseValue -= skill.mpCost;
     
     Action a;
     a.actionValue = skill.damage;
     a.element = skill.element;
     a.type = skill.type;
     
     ActionInfo aInfo = ActionCalculation(a, sender, receiver);
     actionQueue.Add(aInfo);
 }
예제 #35
0
    public void DoUseItem(Item item, BattleActor sender, BattleActor receiver)
    {
		if(item.type == Item.ItemType.Consumable)
		{
			ActionInfo aInfo = new ActionInfo();
			aInfo.isUsingItem = true;
			aInfo.item = item;
			aInfo.sender = sender;
			aInfo.receiver = receiver;
	        actionQueue.Add(aInfo);
		}
		else
		{
			Debug.Log("Non-consumable item was attempted to be used");
		}
    }
예제 #36
0
    ActionInfo ActionCalculation(Action a, BattleActor s, BattleActor r)
    {
        int baseVal = a.actionValue;
        float critVal = 0;
        float defVal = 0;
        float elmtVal = 1;
        
        if(s.GetStat("Luck").GetValue() > Random.Range(0,400))
        {
            critVal = Random.Range(1.5f, 1.75f);
        }
        
        if(r.isDefending)
        {
            float bonusVal = (critVal > 1f) ? 1.2f : 3f;
            defVal = r.GetStat("Defense").GetValue()*bonusVal;
        }
        else
        {
            defVal = r.GetStat("Defense").GetValue()/2;
        }

        elmtVal = GetElementDamageValue(a.element, r.actor.activeElement);       
        
        ActionInfo info;
        info.sender = s;
        info.receiver = r;
        info.critHit = (critVal > 1);
        info.elmtHit = (elmtVal > 1);
        info.finalVal = Mathf.CeilToInt((baseVal * (1 + critVal + elmtVal)) - defVal);
		info.item = new Item();
		info.isDefending = false;
		info.isUsingItem = false;

        return info;
    }
    /// <summary>
    /// Selecteds the enemy.
    /// </summary>
    /// <param name='actor'>
    /// Actor.
    /// </param>
    public void SelectedEnemy(BattleActor actor)
    {
        currentTurn.targetedActor = actor;
        currentTurn.state = BattleRound.State.Act;

        Utilities().AppendBattleText(new SelectedActionText(currentTurn.actor.name,
                                                            currentTurn.selectedAction.name,
                                                            currentTurn.targetedActor.name));

        BattleActorActed();
    }
        public BattleRound(BattleActor turnActor)
        {
            actor = turnActor;
            state = State.SelectAction;

            bIsPlayer = (turnActor.GetType() == typeof(Player));

            bRolledChanceToHit = false;
            bChanceToHitSuccess = false;
            numberOfDamageDiceStillRolling = 0;
            rolledDamage = 0;
            bActionSelected = false;
            bTargetSelected = false;
            bPlayerActed = false;
        }