Пример #1
0
    void On_ShieldChanged(ModuleShield newShield) //更换防具时机体基础护甲护盾恢复
    {
        if (m_Shield != null)
        {
            if (!M_Shield.CardInfo.BaseInfo.IsTemp)
            {
                BattlePlayer.CardDeckManager.CardDeck.RecycleCardInstanceID(m_Shield.OriginCardInstanceId);
            }
            m_Shield.UnRegisterSideEffect();
        }

        m_Shield = newShield;
        BattlePlayer.GameManager.EventManager.Invoke(SideEffectExecute.TriggerTime.OnEquipEquiped, new ExecutorInfo(clientId: BattlePlayer.ClientId, mechId: M_MechID, equipId: m_Shield.M_EquipID));
        EquipShieldServerRequest request = new EquipShieldServerRequest(BattlePlayer.ClientId, (CardInfo_Equip)newShield.GetCurrentCardInfo(), M_MechID, m_Shield.M_EquipID);

        BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request);

        int shield_before = m_MechShield;
        int armor_before  = m_MechArmor;

        m_MechShield = CardInfo.BattleInfo.BasicShield + newShield.CardInfo.ShieldInfo.Shield;
        m_MechArmor  = CardInfo.BattleInfo.BasicArmor + newShield.CardInfo.ShieldInfo.Armor;

        MechAttributesChangeRequest request2 = new MechAttributesChangeRequest(BattlePlayer.ClientId, M_MechID, addShield: m_MechShield - shield_before, addArmor: m_MechArmor - armor_before);

        BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request2);
    }
Пример #2
0
    void On_ShieldDown()
    {
        if (m_Shield != null)
        {
            if (!M_Shield.CardInfo.BaseInfo.IsTemp)
            {
                BattlePlayer.CardDeckManager.CardDeck.RecycleCardInstanceID(m_Shield.OriginCardInstanceId);
            }
            BattlePlayer.GameManager.EventManager.Invoke(SideEffectExecute.TriggerTime.OnEquipDie, new ExecutorInfo(clientId: BattlePlayer.ClientId, mechId: M_MechID, equipId: m_Shield.M_EquipID));
            m_Shield.UnRegisterSideEffect();

            EquipShieldServerRequest request = new EquipShieldServerRequest(BattlePlayer.ClientId, null, M_MechID, m_Shield.M_EquipID);
            BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request);
            m_Shield = null;

            int addShield = 0;
            if (m_MechShield >= CardInfo.BattleInfo.BasicShield)
            {
                addShield = CardInfo.BattleInfo.BasicShield - m_MechShield;
            }

            int addArmor = 0;
            if (m_MechArmor >= CardInfo.BattleInfo.BasicArmor)
            {
                addArmor = CardInfo.BattleInfo.BasicArmor - m_MechArmor;
            }

            MechAttributesChangeRequest request2 = new MechAttributesChangeRequest(BattlePlayer.ClientId, M_MechID, addShield: addShield, addArmor: addArmor);
            BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request2);
        }
    }
Пример #3
0
    void On_WeaponChanged(ModuleWeapon newWeapon)
    {
        if (m_Weapon != null)
        {
            if (!M_Weapon.CardInfo.BaseInfo.IsTemp)
            {
                BattlePlayer.CardDeckManager.CardDeck.RecycleCardInstanceID(m_Weapon.OriginCardInstanceId);
            }
            m_Weapon.UnRegisterSideEffect();
        }

        m_Weapon = newWeapon;
        BattlePlayer.GameManager.EventManager.Invoke(SideEffectExecute.TriggerTime.OnEquipEquiped, new ExecutorInfo(clientId: BattlePlayer.ClientId, mechId: M_MechID, equipId: m_Weapon.M_EquipID));
        EquipWeaponServerRequest request = new EquipWeaponServerRequest(BattlePlayer.ClientId, (CardInfo_Equip)newWeapon.GetCurrentCardInfo(), M_MechID, m_Weapon.M_EquipID);

        BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request);

        RefreshAttackTime();
        int att_before   = m_MechAttack;
        int we_before    = m_MechWeaponEnergy;
        int weMax_before = m_MechWeaponEnergyMax;

        m_MechAttack          = CardInfo.BattleInfo.BasicAttack + newWeapon.CardInfo.WeaponInfo.Attack;
        m_MechWeaponEnergyMax = newWeapon.CardInfo.WeaponInfo.EnergyMax;
        m_MechWeaponEnergy    = newWeapon.CardInfo.WeaponInfo.Energy;
        if (m_MechWeaponEnergy == 0)
        {
            m_MechAttack = CardInfo.BattleInfo.BasicAttack;
        }

        MechAttributesChangeRequest request2 = new MechAttributesChangeRequest(BattlePlayer.ClientId, M_MechID, addAttack: m_MechAttack - att_before, addWeaponEnergy: m_MechWeaponEnergy - we_before, addWeaponEnergyMax: m_MechWeaponEnergyMax - weMax_before);

        BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request2);
    }
Пример #4
0
    void On_WeaponDown()
    {
        if (m_Weapon != null)
        {
            if (!M_Weapon.CardInfo.BaseInfo.IsTemp)
            {
                BattlePlayer.CardDeckManager.CardDeck.RecycleCardInstanceID(m_Weapon.OriginCardInstanceId);
            }
            BattlePlayer.GameManager.EventManager.Invoke(SideEffectExecute.TriggerTime.OnEquipDie, new ExecutorInfo(clientId: BattlePlayer.ClientId, mechId: M_MechID, equipId: m_Weapon.M_EquipID));
            m_Weapon.UnRegisterSideEffect();

            EquipWeaponServerRequest request = new EquipWeaponServerRequest(clientId: BattlePlayer.ClientId, cardInfo: null, mechId: M_MechID, equipID: m_Weapon.M_EquipID);
            BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request);
            m_Weapon = null;

            int att_before   = m_MechAttack;
            int we_before    = m_MechWeaponEnergy;
            int weMax_before = m_MechWeaponEnergyMax;

            m_MechAttack          = CardInfo.BattleInfo.BasicAttack;
            m_MechWeaponEnergy    = 0;
            m_MechWeaponEnergyMax = 0;

            MechAttributesChangeRequest request2 = new MechAttributesChangeRequest(BattlePlayer.ClientId, M_MechID, addAttack: m_MechAttack - att_before, addWeaponEnergy: m_MechWeaponEnergy - we_before, addWeaponEnergyMax: m_MechWeaponEnergyMax - weMax_before);
            BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request2);
        }
    }
Пример #5
0
    private void OnMechAttributesChange(MechAttributesChangeRequest r)
    {
        ModuleMech mech = GetPlayerByClientId(r.clinetId).BattlePlayer.BattleGroundManager.GetMech(r.mechId);

        mech.MechSwordShieldArmorComponent.IsAttackChanging = r.addAttack != 0;
        mech.M_MechWeaponEnergyMax += r.addWeaponEnergyMax;
        mech.M_MechWeaponEnergy    += r.addWeaponEnergy;
        mech.M_MechAttack          += r.addAttack;
        mech.MechSwordShieldArmorComponent.IsAttackChanging = false;
        mech.M_MechArmor  += r.addArmor;
        mech.M_MechShield += r.addShield;
        mech.MechLifeComponent.IsTotalLifeChanging = r.addMaxLife != 0;
        mech.M_MechTotalLife += r.addMaxLife;
        mech.M_MechLeftLife  += r.addLeftLife;
        mech.MechLifeComponent.IsTotalLifeChanging = false;
    }
Пример #6
0
    void On_ShieldEquiped(ModuleShield newShield)
    {
        m_Shield = newShield;
        BattlePlayer.GameManager.EventManager.Invoke(SideEffectExecute.TriggerTime.OnEquipEquiped, new ExecutorInfo(clientId: BattlePlayer.ClientId, mechId: M_MechID, equipId: m_Shield.M_EquipID));
        EquipShieldServerRequest request = new EquipShieldServerRequest(BattlePlayer.ClientId, (CardInfo_Equip)newShield.GetCurrentCardInfo(), M_MechID, m_Shield.M_EquipID);

        BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request);

        int shield_before = m_MechShield;
        int armor_before  = m_MechArmor;

        m_MechArmor  += newShield.CardInfo.ShieldInfo.Armor;
        m_MechShield += newShield.CardInfo.ShieldInfo.Shield;

        MechAttributesChangeRequest request2 = new MechAttributesChangeRequest(BattlePlayer.ClientId, M_MechID, addShield: m_MechShield - shield_before, addArmor: m_MechArmor - armor_before);

        BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request2);
    }
Пример #7
0
    protected virtual void OnMaxLifeChanged(int change)
    {
        MechAttributesChangeRequest request = new MechAttributesChangeRequest(BattlePlayer.ClientId, M_MechID, addMaxLife: change);

        BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request);
    }