private void RemoveMech(ModuleMech mech) { int battleGroundIndex = Mechs.IndexOf(mech); if (battleGroundIndex == -1) { BattlePlayer.GameManager.DebugLog.PrintWarning("BattleGroundRemoveMech not exist mech:" + mech.M_MechID); return; } Mechs.Remove(mech); MechCount = Mechs.Count; if (mech.CardInfo.MechInfo.IsSoldier) { Soldiers.Remove(mech); SoldierCount = Soldiers.Count; } else { Heroes.Remove(mech); HeroCount = Heroes.Count; } if (!mech.CardInfo.BaseInfo.IsTemp) { BattlePlayer.CardDeckManager.CardDeck.RecycleCardInstanceID(mech.OriginCardInstanceId); } mech.UnRegisterSideEffect(); }
public void AddMech(CardInfo_Mech mechCardInfo, int mechPlaceIndex, List <int> targetMechIds, int clientMechTempId, int handCardInstanceId) { if (BattleGroundIsFull) { return; } int mechId = BattlePlayer.GameManager.GenerateNewMechId(); BattleGroundAddMechRequest request = new BattleGroundAddMechRequest(BattlePlayer.ClientId, mechCardInfo, mechPlaceIndex, mechId, clientMechTempId); BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request); ModuleMech mech = new ModuleMech(); mech.M_MechID = mechId; mech.M_ClientTempMechID = clientMechTempId; mech.OriginCardInstanceId = handCardInstanceId; mech.Initiate(mechCardInfo, BattlePlayer); BattlePlayer.CardDeckManager.CardDeck.AddCardInstanceId(mechCardInfo.CardID, handCardInstanceId); BattleGroundAddMech(mechPlaceIndex, mech); ExecutorInfo info = new ExecutorInfo(clientId: BattlePlayer.ClientId, mechId: mechId, targetMechIds: targetMechIds); if (mechCardInfo.MechInfo.IsSoldier) { BattlePlayer.GameManager.EventManager.Invoke(SideEffectExecute.TriggerTime.OnSoldierSummon, info); } else { BattlePlayer.GameManager.EventManager.Invoke(SideEffectExecute.TriggerTime.OnHeroSummon, info); } }
public override bool Execute(ExecutorInfo executorInfo) { if (!base.Execute(executorInfo)) { return(false); } BattlePlayer player = (BattlePlayer)Player; int healPercent = M_SideEffectParam.GetParam_MultipliedInt("Percent"); if (TargetRange == TargetRange.Self) // 对自身 { ModuleMech mech = player.BattleGroundManager.GetMech(executorInfo.MechId); int healValue = (int)Math.Ceiling((float)healPercent * mech.M_MechTotalLife / 100); player.BattleGroundManager.GetMech(executorInfo.MechId).Heal(healValue); } else { player.GameManager.SideEffect_ILifeAction( delegate(ILife life) { int healValue = (int)Math.Ceiling((float)healPercent * life.GetTotalLife() / 100); life.Heal(healValue); }, player, ChoiceCount, TargetRange, TargetSelect, executorInfo.TargetClientIds, executorInfo.TargetMechIds ); } return(true); }
public void Initialize(ClientPlayer clientPlayer, ModuleMech mech, SlotTypes slotType) { ClientPlayer = clientPlayer; Mech = mech; MSlotTypes = slotType; SlotBoxCollider.enabled = Mech != null; }
//装备武器 private void summonEquipRequest(ModuleMech moduleMech, Vector3 dragLastPosition) { switch (M_EquipType) { case SlotTypes.Weapon: { EquipWeaponRequest request = new EquipWeaponRequest(Client.Instance.Proxy.ClientID, M_CardInstanceId, moduleMech.M_MechID); Client.Instance.Proxy.SendMessage(request); break; } case SlotTypes.Shield: { EquipShieldRequest request = new EquipShieldRequest(Client.Instance.Proxy.ClientID, M_CardInstanceId, moduleMech.M_MechID); Client.Instance.Proxy.SendMessage(request); break; } case SlotTypes.Pack: { EquipPackRequest request = new EquipPackRequest(Client.Instance.Proxy.ClientID, M_CardInstanceId, moduleMech.M_MechID); Client.Instance.Proxy.SendMessage(request); break; } case SlotTypes.MA: { EquipMARequest request = new EquipMARequest(Client.Instance.Proxy.ClientID, M_CardInstanceId, moduleMech.M_MechID); Client.Instance.Proxy.SendMessage(request); break; } } Usable = false; }
private void OnMechDie(MechDieRequest r) { List <ModuleMech> dieMechs = new List <ModuleMech>(); foreach (int mechId in r.mechIds) { ModuleMech mech = SelfClientPlayer.BattlePlayer.BattleGroundManager.GetMech(mechId); if (mech != null) { dieMechs.Add(mech); } else { mech = EnemyClientPlayer.BattlePlayer.BattleGroundManager.GetMech(mechId); if (mech != null) { dieMechs.Add(mech); } } } foreach (ModuleMech moduleMech in dieMechs) { moduleMech.OnDie(); } BattleEffectsManager.Instance.Effect_Main.EffectsShow(Co_MechDieShock(dieMechs), "Co_MechDieShock"); }
private void OnMechCardInfoSync(MechCardInfoSyncRequest r) { ClientPlayer cp = GetPlayerByClientId(r.clientId); ModuleMech mech = cp.BattlePlayer.BattleGroundManager.GetMech(r.instanceId); mech.CardInfo = r.cardInfo.Clone(); }
private void OnMechCanAttackChange(MechCanAttackRequest r) { ClientPlayer cp = GetPlayerByClientId(r.clientId); ModuleMech mech = cp.BattlePlayer.BattleGroundManager.GetMech(r.mechId); mech.SetCanAttack(r.canAttack); }
private void OnMechImmuneChange(MechImmuneStateRequest r) { ClientPlayer cp = GetPlayerByClientId(r.clientId); ModuleMech mech = cp.BattlePlayer.BattleGroundManager.GetMech(r.mechId); mech.M_ImmuneLeftRounds = r.immuneRounds; }
/// <summary> /// 当对方场上有机甲,剑及近战攻击无法攻击ship;当对方场上有Defence,枪无法攻击ship;SniperGun随时可以攻击Ship /// </summary> /// <param name="attackMech"></param> /// <returns></returns> public AttackFactor CheckModuleMechCanAttackMe(ModuleMech attackMech) { if (attackMech.ClientPlayer == ClientPlayer) { return(AttackFactor.None); } if (attackMech.MechEquipSystemComponent.M_Weapon) { switch (attackMech.MechEquipSystemComponent.M_Weapon.M_WeaponType) { case WeaponTypes.Sword: if (ClientPlayer.BattlePlayer.BattleGroundManager.BattleGroundIsEmpty) { return(AttackFactor.Sword); } return(0); case WeaponTypes.Gun: if (attackMech.M_MechWeaponEnergy != 0) { if (ClientPlayer.BattlePlayer.BattleGroundManager.HasDefenceMech) { return(0); } return(AttackFactor.Gun); } else { if (ClientPlayer.BattlePlayer.BattleGroundManager.BattleGroundIsEmpty) { return(AttackFactor.Sword); } return(0); } case WeaponTypes.SniperGun: if (attackMech.M_MechWeaponEnergy != 0) { return(AttackFactor.Gun); } else { if (ClientPlayer.BattlePlayer.BattleGroundManager.BattleGroundIsEmpty) { return(AttackFactor.Sword); } return(0); } } } else { if (ClientPlayer.BattlePlayer.BattleGroundManager.BattleGroundIsEmpty) { return(AttackFactor.Sword); } } return(AttackFactor.None); }
private void OnMechShieldDefence(MechShieldDefenseRequest r) { ClientPlayer cp = GetPlayerByClientId(r.clientId); ModuleMech mech = cp.BattlePlayer.BattleGroundManager.GetMech(r.mechId); mech.MechSwordShieldArmorComponent.ShieldDefenceDamage(r.decreaseValue, r.shieldValue); }
IEnumerator Co_RefreshBattleGroundAnim(BattleEffectsManager.Effects myParentEffects, int mechPlaceIndex = (int)mechPlaceIndex.NoNewMech) { bool isAddMech = mechPlaceIndex != (int)BattleGroundManager.mechPlaceIndex.NoNewMech; if (isAddMech) //新增机甲 { ModuleMech mech = AddPrePassMechQueue.Dequeue(); Mechs.Insert(mechPlaceIndex, mech); if (mech.CardInfo.MechInfo.IsSoldier) { Soldiers.Add(mech); } else { Heros.Add(mech); } mech.OnSummon(); mech.transform.position = DefaultMechPivot.transform.position; mech.transform.transform.Translate(Vector3.left * (Mechs.IndexOf(mech) - Mechs.Count / 2.0f + 0.5f) * MECH_INTERVAL, Space.Self); } float duration = 0.1f; Vector3[] targetPos = new Vector3[Mechs.Count]; int actualPlaceCount = previewMechPlace == PREVIEW_MECH_PLACES_NO_PREVIEW_MECH_NOW ? Mechs.Count : Mechs.Count + 1; for (int i = 0; i < Mechs.Count; i++) { int actualPlace = i; if (previewMechPlace != PREVIEW_MECH_PLACES_NO_PREVIEW_MECH_NOW && i >= previewMechPlace) { actualPlace += 1; } Vector3 ori = Mechs[i].transform.position; Vector3 offset = Vector3.left * (actualPlace - actualPlaceCount / 2.0f + 0.5f) * MECH_INTERVAL; Mechs[i].transform.position = DefaultMechPivot.transform.position; Mechs[i].transform.Translate(offset, Space.Self); targetPos[i] = Mechs[i].transform.position; Mechs[i].transform.position = ori; Mechs[i].transform.DOMove(targetPos[i], duration).SetEase(Ease.Linear); } ClientPlayer.BattlePlayer.HandManager.RefreshAllCardUsable(); yield return(new WaitForSeconds(duration)); if (isAddMech && DragManager.Instance.IsSummonPreview) { DragManager.Instance.IsArrowShowBegin = true; } yield return(null); myParentEffects.EffectEnd(); }
private void OnMechInactivityChange(MechInactivityStateRequest r) { ClientPlayer cp = GetPlayerByClientId(r.clientId); ModuleMech mech = cp.BattlePlayer.BattleGroundManager.GetMech(r.mechId); mech.M_InactivityRounds = r.inactivityRounds; }
IEnumerator Co_MechAttackChange(int mechAttackValue, int mechEnergy, int mechEnergyMax, int change, float duration, bool cur_IsInitializing) { if (!cur_IsInitializing) { string text = LanguageManager.Instance.GetText("ModuleMech_AttackChangeNumberFly"); if (change > 0) { WeaponAttackChangeNumberFly.SetText(text + "+" + change, "#FFF500", "#FFF500", TextFly.FlyDirection.Up); FXManager.Instance.PlayFX(SwordBar.transform, FXManager.FXType.FX_WeaponEnergyUp, "#FFFFFF", 0.3f); } else if (change < 0) { WeaponAttackChangeNumberFly.SetText(text + change, "#FFF500", "#FFF500", TextFly.FlyDirection.Down); } } int finalAttack = ModuleMech.CalculateFinalAttack(mechAttackValue, mechEnergy); SwordText.text = finalAttack > 0 ? finalAttack.ToString() : ""; SwordTrough.color = finalAttack > 0 ? ClientUtils.HTMLColorToColor("#ffffff") : ClientUtils.HTMLColorToColor("#333333"); RefreshSwordBarMask(mechEnergy, mechEnergyMax); yield return(new WaitForSeconds(duration)); BattleEffectsManager.Instance.Effect_Main.EffectEnd(); }
private void OnMechAttackShip(MechAttackShipServerRequest r) { ClientPlayer cp_attack = GetPlayerByClientId(r.AttackMechClientId); ClientPlayer cp_beAttack = cp_attack.WhichPlayer == Players.Self ? EnemyClientPlayer : SelfClientPlayer; ModuleMech attackMech = cp_attack.BattlePlayer.BattleGroundManager.GetMech(r.AttackMechId); attackMech.AttackShip(cp_beAttack); }
private void OnMechOnAttack(MechOnAttackRequest r) { ClientPlayer cp = GetPlayerByClientId(r.clientId); ModuleMech mech = FindMech(r.mechId); ModuleMech targetMech = FindMech(r.targetMechId); mech.OnAttack(r.weaponType, targetMech, targetMech.IsDead); }
private void OnMechOnAttackShip(MechOnAttackShipRequest r) { ClientPlayer cp = GetPlayerByClientId(r.clientId); ClientPlayer cp_target = GetPlayerByClientId(r.targetClientId); ModuleMech mech = FindMech(r.mechId); mech.OnAttackShip(r.weaponType, cp_target.BattlePlayer.Ship); }
public void SummonMechPreview(CardMech mechCard, int mechPlaceIndex, TargetRange targetRange) //用于具有指定目标的副作用的机甲的召唤预览、显示指定箭头 { currentSummonPreviewMechCard = mechCard; ModuleMech mech = AddMech_PrePass((CardInfo_Mech)mechCard.CardInfo, (int)Const.SpecialMechID.Empty, (int)Const.SpecialMechID.ClientTempMechIDNormal); CurrentSummonPreviewMech = mech; AddMech(mechPlaceIndex); DragManager.Instance.StartSummonMechTargetArrowAiming(mech, targetRange); }
private void summonSpellRequestToMech(ModuleMech targetModuleMech) { UseSpellCardToMechRequest request = new UseSpellCardToMechRequest(Client.Instance.Proxy.ClientID, M_CardInstanceId, new List <ValueTuple <int, bool> > { targetModuleMech.M_TargetMechID }); Client.Instance.Proxy.SendMessage(request); Usable = false; }
public void OnMechAttackMech(MechAttackMechServerRequest r) { ClientPlayer cp_attack = GetPlayerByClientId(r.AttackMechClientId); ClientPlayer cp_beAttack = GetPlayerByClientId(r.BeAttackedMechClientId); ModuleMech attackMech = cp_attack.BattlePlayer.BattleGroundManager.GetMech(r.AttackMechId); ModuleMech beAttackMech = cp_beAttack.BattlePlayer.BattleGroundManager.GetMech(r.BeAttackedMechId); attackMech.Attack(beAttackMech, false); }
public bool CheckModuleMechCanAttackMe(ModuleMech attackMech) { if (attackMech.M_Weapon != null) { switch (attackMech.M_Weapon.M_WeaponType) { case WeaponTypes.Sword: if (BattleGroundManager.BattleGroundIsEmpty) { return(true); } return(false); case WeaponTypes.Gun: if (attackMech.M_MechWeaponEnergy != 0) { if (BattleGroundManager.HasDefenseMech) { return(false); } return(true); } else { if (BattleGroundManager.BattleGroundIsEmpty) { return(true); } return(false); } case WeaponTypes.SniperGun: if (attackMech.M_MechWeaponEnergy != 0) { return(true); } else { if (BattleGroundManager.BattleGroundIsEmpty) { return(true); } return(false); } } } else { if (BattleGroundManager.BattleGroundIsEmpty) { return(true); } } return(false); }
public ModuleMech GetMechOnBattleGround(int mechId) { ModuleMech mech = PlayerA.BattleGroundManager.GetMech(mechId); if (mech == null) { mech = PlayerB.BattleGroundManager.GetMech(mechId); } return(mech); }
public void SetSlot(ClientPlayer clientPlayer, ModuleMech mech, MechInfo mechInfo) { for (int i = 0; i < Slots.Length; i++) { if (Slots[i] != null) { Slots[i].Initialize(clientPlayer, mech, mechInfo.Slots[i]); } } }
public void RemoveMechs(List <int> mechIds) { foreach (int mechId in mechIds) { ModuleMech mech = GetMech(mechId); if (mech != null) { RemoveMech(mech); } } }
private static void GetAffixTypeByMech(HashSet <AffixType> affixTypes, ModuleMech mech) { if (mech.M_ImmuneLeftRounds != 0) { affixTypes.Add(AffixType.Immune); } if (mech.M_InactivityRounds != 0) { affixTypes.Add(AffixType.Inactivity); } }
public void EquipWeapon(EquipWeaponRequest r, CardInfo_Base cardInfo) { ModuleWeapon weapon = new ModuleWeapon(); CardInfo_Equip cardInfo_Weapon = (CardInfo_Equip)cardInfo; ModuleMech mech = GetMech(r.mechId); weapon.M_ModuleMech = mech; weapon.M_EquipID = BattlePlayer.GameManager.GenerateNewEquipId(); weapon.Initiate(cardInfo_Weapon, BattlePlayer); weapon.OriginCardInstanceId = r.handCardInstanceId; mech.M_Weapon = weapon; BattlePlayer.CardDeckManager.CardDeck.AddCardInstanceId(cardInfo.CardID, r.handCardInstanceId); }
public void EquipPack(EquipPackRequest r, CardInfo_Base cardInfo) { ModulePack pack = new ModulePack(); CardInfo_Equip cardInfo_Pack = (CardInfo_Equip)cardInfo; ModuleMech mech = GetMech(r.mechID); pack.M_ModuleMech = mech; pack.M_EquipID = BattlePlayer.GameManager.GenerateNewEquipId(); pack.Initiate(cardInfo_Pack, BattlePlayer); pack.OriginCardInstanceId = r.handCardInstanceId; mech.M_Pack = pack; BattlePlayer.CardDeckManager.CardDeck.AddCardInstanceId(cardInfo.CardID, r.handCardInstanceId); }
public void EquipMA(EquipMARequest r, CardInfo_Base cardInfo) { ModuleMA ma = new ModuleMA(); CardInfo_Equip cardInfo_MA = (CardInfo_Equip)cardInfo; ModuleMech mech = GetMech(r.mechID); ma.M_ModuleMech = mech; ma.M_EquipID = BattlePlayer.GameManager.GenerateNewEquipId(); ma.Initiate(cardInfo_MA, BattlePlayer); ma.OriginCardInstanceId = r.handCardInstanceId; mech.M_MA = ma; BattlePlayer.CardDeckManager.CardDeck.AddCardInstanceId(cardInfo.CardID, r.handCardInstanceId); }
public void EquipShield(EquipShieldRequest r, CardInfo_Base cardInfo) { ModuleShield shield = new ModuleShield(); CardInfo_Equip cardInfo_Shield = (CardInfo_Equip)cardInfo; ModuleMech mech = GetMech(r.mechID); shield.M_ModuleMech = mech; shield.M_EquipID = BattlePlayer.GameManager.GenerateNewEquipId(); shield.Initiate(cardInfo_Shield, BattlePlayer); shield.OriginCardInstanceId = r.handCardInstanceId; mech.M_Shield = shield; BattlePlayer.CardDeckManager.CardDeck.AddCardInstanceId(cardInfo.CardID, r.handCardInstanceId); }
public void OnMousePressEnterImmediately() { if (DragManager.Instance.CurrentDrag) { ModuleMech mr = DragManager.Instance.CurrentDrag_ModuleMech; CardSpell cs = DragManager.Instance.CurrentDrag_CardSpell; if (mr != null && Mech.CheckModuleMechCanAttackMe(mr)) { OnAttrShapeHoverShow(); } else if (cs != null && Mech.CheckCardSpellCanTarget(cs)) { OnAttrShapeHoverShow(); } } }