private void OnActorDeadIncomeSoul(ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker) { if (!target || !attacker) { return; } ResIncomeAllocRule resIncomeAllocRule = null; switch (target.get_handle().TheActorMeta.ActorType) { case ActorTypeDef.Actor_Type_Hero: resIncomeAllocRule = this.m_incomeAllocRules[1][3]; break; case ActorTypeDef.Actor_Type_Monster: { MonsterWrapper monsterWrapper = target.get_handle().AsMonster(); if (monsterWrapper != null) { RES_MONSTER_TYPE bMonsterType = monsterWrapper.cfgInfo.bMonsterType; if (bMonsterType == 2) { resIncomeAllocRule = this.m_incomeAllocRules[1][4]; } else if (bMonsterType == 1) { resIncomeAllocRule = this.m_incomeAllocRules[1][2]; } } break; } case ActorTypeDef.Actor_Type_Organ: resIncomeAllocRule = this.m_incomeAllocRules[1][1]; break; case ActorTypeDef.Actor_Type_EYE: resIncomeAllocRule = this.m_incomeAllocRules[1][6]; break; } if (resIncomeAllocRule != null) { ResDT_IncomeAttackRule incomeAllocRuleByAtker = this.GetIncomeAllocRuleByAtker(ref attacker, resIncomeAllocRule); if (incomeAllocRuleByAtker != null) { this.AllocIncome(ref target, ref attacker, incomeAllocRuleByAtker, enIncomeType.Soul, resIncomeAllocRule.IncomeChangeRate, resIncomeAllocRule.iComputerChangeRate); } } }
public void AddActor(PoolObjHandle <ActorRoot> actor) { StringHelper.ClearFormater(); StringHelper.Formater.Append(actor.handle.ActorControl.GetTypeName()); StringHelper.Formater.Append(actor.handle.ObjID); StringHelper.Formater.Append("("); StringHelper.Formater.Append(actor.handle.TheStaticData.TheResInfo.Name); StringHelper.Formater.Append(")"); actor.handle.name = StringHelper.Formater.ToString(); actor.handle.gameObject.name = actor.handle.name; this.GameActors.Add(actor); if (actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { this.HeroActors.Add(actor); } else if (actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ) { this.OrganActors.Add(actor); if (actor.handle.TheStaticData.TheOrganOnlyInfo.OrganType == 1 || actor.handle.TheStaticData.TheOrganOnlyInfo.OrganType == 4) { this.TowerActors.Add(actor); } } else if (actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) { this.MonsterActors.Add(actor); MonsterWrapper monsterWrapper = actor.handle.AsMonster(); if (monsterWrapper != null && monsterWrapper.cfgInfo != null) { RES_MONSTER_TYPE bMonsterType = (RES_MONSTER_TYPE)monsterWrapper.cfgInfo.bMonsterType; if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_SOLDIERLINE) { this.SoldierActors.Add(actor); } } } else if (actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE) { this.FakeTrueEyes.Add(actor); } else if (actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Call) { this.CallActors.Add(actor); } actor.handle.isRecycled = false; this.CampsActors[(int)actor.handle.TheActorMeta.ActorCamp].Add(actor); }
private ResDT_IncomeAttackRule GetIncomeAllocRuleByAtker(ref PoolObjHandle <ActorRoot> attacker, ResIncomeAllocRule incomeRule) { if (incomeRule == null || !attacker) { return(null); } RES_INCOME_ATTACKER_TYPE rES_INCOME_ATTACKER_TYPE = RES_INCOME_ATTACKER_TYPE.RES_INCOME_ATTACKER_ALL; switch (attacker.handle.TheActorMeta.ActorType) { case ActorTypeDef.Actor_Type_Hero: rES_INCOME_ATTACKER_TYPE = RES_INCOME_ATTACKER_TYPE.RES_INCOME_ATTACKER_HERO; break; case ActorTypeDef.Actor_Type_Monster: { MonsterWrapper monsterWrapper = attacker.handle.AsMonster(); if (monsterWrapper != null) { RES_MONSTER_TYPE bMonsterType = (RES_MONSTER_TYPE)monsterWrapper.cfgInfo.bMonsterType; if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_JUNGLE) { rES_INCOME_ATTACKER_TYPE = RES_INCOME_ATTACKER_TYPE.RES_INCOME_ATTACKER_MONSTER; } else if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_SOLDIERLINE) { rES_INCOME_ATTACKER_TYPE = RES_INCOME_ATTACKER_TYPE.RES_INCOME_ATTACKER_SOLDIER; } } break; } case ActorTypeDef.Actor_Type_Organ: rES_INCOME_ATTACKER_TYPE = RES_INCOME_ATTACKER_TYPE.RES_INCOME_ATTACKER_ORGAN; break; } for (int i = 0; i < 4; i++) { if (incomeRule.astIncomeRule[i].bAttakerType == 1 || rES_INCOME_ATTACKER_TYPE == (RES_INCOME_ATTACKER_TYPE)incomeRule.astIncomeRule[i].bAttakerType) { return(incomeRule.astIncomeRule[i]); } } return(null); }
private ResDT_IncomeAttackRule GetIncomeAllocRuleByAtker(ref PoolObjHandle <ActorRoot> attacker, ResIncomeAllocRule incomeRule) { if (incomeRule == null || !attacker) { return(null); } RES_INCOME_ATTACKER_TYPE rES_INCOME_ATTACKER_TYPE = 1; switch (attacker.get_handle().TheActorMeta.ActorType) { case ActorTypeDef.Actor_Type_Hero: rES_INCOME_ATTACKER_TYPE = 4; break; case ActorTypeDef.Actor_Type_Monster: { MonsterWrapper monsterWrapper = attacker.get_handle().AsMonster(); if (monsterWrapper != null) { RES_MONSTER_TYPE bMonsterType = monsterWrapper.cfgInfo.bMonsterType; if (bMonsterType == 2) { rES_INCOME_ATTACKER_TYPE = 5; } else if (bMonsterType == 1) { rES_INCOME_ATTACKER_TYPE = 3; } } break; } case ActorTypeDef.Actor_Type_Organ: rES_INCOME_ATTACKER_TYPE = 2; break; } for (int i = 0; i < 4; i++) { if (incomeRule.astIncomeRule[i].bAttakerType == 1 || rES_INCOME_ATTACKER_TYPE == incomeRule.astIncomeRule[i].bAttakerType) { return(incomeRule.astIncomeRule[i]); } } return(null); }
private ResDT_IncomeAttackRule GetIncomeAllocRuleByAtker(PoolObjHandle <ActorRoot> attacker, ResIncomeAllocRule incomeRule) { if ((incomeRule != null) && (attacker != 0)) { RES_INCOME_ATTACKER_TYPE res_income_attacker_type = RES_INCOME_ATTACKER_TYPE.RES_INCOME_ATTACKER_ALL; switch (attacker.handle.TheActorMeta.ActorType) { case ActorTypeDef.Actor_Type_Hero: res_income_attacker_type = RES_INCOME_ATTACKER_TYPE.RES_INCOME_ATTACKER_HERO; break; case ActorTypeDef.Actor_Type_Monster: { MonsterWrapper wrapper = attacker.handle.AsMonster(); if (wrapper != null) { RES_MONSTER_TYPE bMonsterType = (RES_MONSTER_TYPE)wrapper.cfgInfo.bMonsterType; if (bMonsterType != RES_MONSTER_TYPE.RES_MONSTER_TYPE_JUNGLE) { if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_SOLDIERLINE) { res_income_attacker_type = RES_INCOME_ATTACKER_TYPE.RES_INCOME_ATTACKER_SOLDIER; } break; } res_income_attacker_type = RES_INCOME_ATTACKER_TYPE.RES_INCOME_ATTACKER_MONSTER; } break; } case ActorTypeDef.Actor_Type_Organ: res_income_attacker_type = RES_INCOME_ATTACKER_TYPE.RES_INCOME_ATTACKER_ORGAN; break; } for (int i = 0; i < 4; i++) { if ((incomeRule.astIncomeRule[i].bAttakerType == 1) || (res_income_attacker_type == ((RES_INCOME_ATTACKER_TYPE)incomeRule.astIncomeRule[i].bAttakerType))) { return(incomeRule.astIncomeRule[i]); } } } return(null); }
private void OnMonsterDeadGold(ref GameDeadEventParam prm) { MonsterWrapper monsterWrapper = prm.src.handle.AsMonster(); PoolObjHandle <ActorRoot> orignalAtker = prm.orignalAtker; if (monsterWrapper == null || monsterWrapper.cfgInfo == null) { return; } RES_MONSTER_TYPE bMonsterType = (RES_MONSTER_TYPE)monsterWrapper.cfgInfo.bMonsterType; if (bMonsterType != RES_MONSTER_TYPE.RES_MONSTER_TYPE_JUNGLE) { return; } if (!orignalAtker || orignalAtker.handle.EffectControl == null) { return; } orignalAtker.handle.EffectControl.PlayDyingGoldEffect(prm.src); Singleton <CSoundManager> .instance.PlayBattleSound("Glod_Get", prm.src, prm.src.handle.gameObject); }
private void OnActorDeadIncomeGoldCoinInBattle(ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker) { if (!target || !attacker) { return; } if (ActorHelper.IsHostCtrlActor(ref attacker) && (target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster || target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)) { if (attacker.handle.EffectControl != null) { attacker.handle.EffectControl.PlayDyingGoldEffect(target); } Singleton <CSoundManager> .GetInstance().PlayBattleSound("Glod_Get", target, target.handle.gameObject); } ResIncomeAllocRule resIncomeAllocRule = null; switch (target.handle.TheActorMeta.ActorType) { case ActorTypeDef.Actor_Type_Hero: resIncomeAllocRule = this.m_incomeAllocRules[2][3]; break; case ActorTypeDef.Actor_Type_Monster: { MonsterWrapper monsterWrapper = target.handle.AsMonster(); if (monsterWrapper != null) { RES_MONSTER_TYPE bMonsterType = (RES_MONSTER_TYPE)monsterWrapper.cfgInfo.bMonsterType; if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_JUNGLE) { byte actorSubSoliderType = monsterWrapper.GetActorSubSoliderType(); if (actorSubSoliderType == 7 || actorSubSoliderType == 8 || actorSubSoliderType == 9) { resIncomeAllocRule = this.m_incomeAllocRules[2][5]; } else if (actorSubSoliderType == 15) { resIncomeAllocRule = this.m_incomeAllocRules[2][7]; } else { resIncomeAllocRule = this.m_incomeAllocRules[2][4]; } } else if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_SOLDIERLINE) { resIncomeAllocRule = this.m_incomeAllocRules[2][2]; } } break; } case ActorTypeDef.Actor_Type_Organ: resIncomeAllocRule = this.m_incomeAllocRules[2][1]; break; case ActorTypeDef.Actor_Type_EYE: resIncomeAllocRule = this.m_incomeAllocRules[2][6]; break; } if (resIncomeAllocRule != null) { ResDT_IncomeAttackRule incomeAllocRuleByAtker = this.GetIncomeAllocRuleByAtker(ref attacker, resIncomeAllocRule); if (incomeAllocRuleByAtker != null) { this.AllocIncome(ref target, ref attacker, incomeAllocRuleByAtker, enIncomeType.GoldCoinInBattle, resIncomeAllocRule.IncomeChangeRate, resIncomeAllocRule.iComputerChangeRate); } } }
private bool CheckTargetFromEnemy(PoolObjHandle <ActorRoot> src, PoolObjHandle <ActorRoot> target) { bool result = false; if (!src || !target) { return(result); } if (src.get_handle().TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Hero) { return(result); } if (target.get_handle().TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Monster) { return(src.get_handle().TheActorMeta.ActorCamp != target.get_handle().TheActorMeta.ActorCamp); } MonsterWrapper monsterWrapper = target.get_handle().AsMonster(); if (monsterWrapper != null) { RES_MONSTER_TYPE bMonsterType = monsterWrapper.cfgInfo.bMonsterType; if (bMonsterType == 1) { if (src.get_handle().TheActorMeta.ActorCamp != target.get_handle().TheActorMeta.ActorCamp) { result = true; } } else if (bMonsterType == 2) { byte actorSubSoliderType = monsterWrapper.GetActorSubSoliderType(); if (actorSubSoliderType != 8 && actorSubSoliderType != 9 && actorSubSoliderType != 7 && actorSubSoliderType != 14) { long num = 0L; long num2 = 0L; VInt3 bornPos = target.get_handle().BornPos; List <PoolObjHandle <ActorRoot> > organActors = Singleton <GameObjMgr> .get_instance().OrganActors; int num3 = 0; for (int i = 0; i < organActors.get_Count(); i++) { PoolObjHandle <ActorRoot> poolObjHandle = organActors.get_Item(i); if (poolObjHandle.get_handle().TheStaticData.TheOrganOnlyInfo.OrganType == 2) { VInt3 location = poolObjHandle.get_handle().location; if (poolObjHandle.get_handle().TheActorMeta.ActorCamp == src.get_handle().TheActorMeta.ActorCamp) { num = (bornPos - location).get_sqrMagnitudeLong2D(); } else { num2 = (bornPos - location).get_sqrMagnitudeLong2D(); } num3++; if (num3 >= 2) { break; } } } if (num > num2) { result = true; } } } } return(result); }
private bool CheckTargetFromEnemy(PoolObjHandle <ActorRoot> src, PoolObjHandle <ActorRoot> target) { bool flag = false; if ((src != 0) && (target != 0)) { float num2; float num3; if (src.handle.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Hero) { return(flag); } if (target.handle.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Monster) { return(ActorHelper.IsHostEnemyActor(ref target)); } MonsterWrapper wrapper = target.handle.AsMonster(); if (wrapper == null) { return(flag); } RES_MONSTER_TYPE bMonsterType = (RES_MONSTER_TYPE)wrapper.cfgInfo.bMonsterType; if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_SOLDIERLINE) { if (src.handle.TheActorMeta.ActorCamp != target.handle.TheActorMeta.ActorCamp) { flag = true; } return(flag); } if (bMonsterType != RES_MONSTER_TYPE.RES_MONSTER_TYPE_JUNGLE) { return(flag); } switch (wrapper.GetActorSubSoliderType()) { case 8: case 9: case 7: case 14: return(flag); default: { num2 = 0f; num3 = 0f; Vector3 position = target.handle.gameObject.transform.position; List <PoolObjHandle <ActorRoot> > organActors = Singleton <GameObjMgr> .instance.OrganActors; int num4 = 0; for (int i = 0; i < organActors.Count; i++) { PoolObjHandle <ActorRoot> handle = organActors[i]; if (handle.handle.TheStaticData.TheOrganOnlyInfo.OrganType == 2) { Vector3 b = handle.handle.gameObject.transform.position; if (handle.handle.TheActorMeta.ActorCamp == src.handle.TheActorMeta.ActorCamp) { num2 = Vector3.Distance(position, b); } else { num3 = Vector3.Distance(position, b); } num4++; if (num4 >= 2) { break; } } } break; } } if (num2 > num3) { flag = true; } } return(flag); }