protected float EvaluateDangerWithTargetPlace(Brain brain, StageObject target) { float val = 1f; OpponentMemory.OpponentRecord opponentRecord = brain.opponentMem.Find(target); if (opponentRecord != null) { switch (opponentRecord.record.placeOfOpponent) { case PLACE.BACK: val = 10f; break; case PLACE.FRONT: val = 90f; break; case PLACE.RIGHT: case PLACE.LEFT: val = 50f; break; } } return(EvaluateValue(val, 1f, 100f)); }
public StageObject GetTargetObjectOfHate() { if (brain.opponentMem.IsHateCycleLastTurn()) { OpponentMemory.OpponentRecord opponentWithNotTargetInHateCycle = brain.opponentMem.GetOpponentWithNotTargetInHateCycle(); if (opponentWithNotTargetInHateCycle != null) { return(opponentWithNotTargetInHateCycle.obj); } } OpponentMemory.OpponentRecord opponentWithHigherHate = brain.opponentMem.GetOpponentWithHigherHate(); if (opponentWithHigherHate != null) { return(opponentWithHigherHate.obj); } List <OpponentMemory.OpponentRecord> listOfSensedOpponent = brain.opponentMem.GetListOfSensedOpponent(); if (listOfSensedOpponent.Count <= 0) { return(null); } int index = Utility.Random(listOfSensedOpponent.Count); OpponentMemory.OpponentRecord opponentRecord = listOfSensedOpponent[index]; return(opponentRecord.obj); }
public void SelectAction() { UpdateActionInfoList(); canUseCount = 0; totalWeight = 0; int[] array = new int[actions.Count]; int continuout_index = -1; int i = 0; for (int count = actions.Count; i < count; i++) { ActionInfo actionInfo = actions[i]; bool flag = actionInfo.data.isUse; if (actionInfo.isForceDisable) { flag = false; } if (actionInfo.data.modeId > 0 && actionInfo.data.modeId != modeId) { flag = false; } if (flag) { canUseCount++; if (canActionWithAliveRegion(actionInfo) && CheckActionByAngryCondition(actionInfo) && (!(actionInfo.data.startWaitInterval > 0f) || !(Time.get_time() - actionInfo.data.startWaitTime < actionInfo.data.startWaitInterval)) && (!(actionInfo.data.lotteryWaitInterval > 0f) || !(Time.get_time() - actionInfo.data.lotteryWaitTime < actionInfo.data.lotteryWaitInterval))) { int num = 0; OpponentMemory.OpponentRecord opponent = brain.targetCtrl.GetOpponent(); if (opponent != null) { num = GetWeight(actionInfo, opponent.record.distanceType, opponent.record.place); } array[i] = num; if (oldIndex == i && enemy.isBoss) { array[i] /= 2; if (num > 0) { continuout_index = i; } } totalWeight += array[i]; } } } if (canUseCount > 0 && !SetupAngryStartAction()) { if (totalWeight <= 0) { SetupActionIndexWhenNoWeight(continuout_index); } else { int num2 = 0; int num3 = Random.Range(0, totalWeight) + 1; int j = 0; for (int count2 = actions.Count; j < count2; j++) { if (array[j] > 0) { num2 += array[j]; if (num2 >= num3) { oldIndex = nowIndex; nowIndex = j; break; } } } if (grabController.IsReadyForRelease()) { nowIndex = actions.FindIndex((ActionInfo action) => action.data.actionID == grabController.releaseActionId); } else if (enemy.counterFlag) { enemy.counterFlag = false; int count3 = actions.Count; int num4 = 0; while (true) { if (num4 >= count3) { return; } if (actions[num4].data.isCounterAttack && (actions[num4].data.modeId <= 0 || actions[num4].data.modeId == modeId)) { break; } num4++; } nowIndex = num4; } } } }
public override void HandleEvent(BRAIN_EVENT ev, object param = null) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) switch (ev) { case BRAIN_EVENT.END_ACTION: if (base.opponentMem != null) { base.opponentMem.Update(); } break; case BRAIN_EVENT.OWN_ATTACK_HIT: if (base.opponentMem != null) { OpponentMemory.OpponentRecord opponentRecord = base.opponentMem.Find(param as StageObject); if (opponentRecord != null) { opponentRecord.record.isDamaged = true; } } break; case BRAIN_EVENT.ATTACKED_HIT: { AttackedHitStatusOwner attackedHitStatusOwner2 = (AttackedHitStatusOwner)param; if (base.opponentMem != null) { OpponentMemory opponentMem2 = base.opponentMem; Vector3 val2 = attackedHitStatusOwner2.fromPos - attackedHitStatusOwner2.hitPos; DISTANCE distance2 = opponentMem2.GetDistance(val2.get_sqrMagnitude()); int num = (int)((float)attackedHitStatusOwner2.damage * base.opponentMem.hateParam.distanceAttackRatio[(int)distance2]); if (isNPC(attackedHitStatusOwner2.fromObject)) { num = (int)((float)num * 0.5f); } base.opponentMem.AddHate(attackedHitStatusOwner2.fromObject, num, Hate.TYPE.Damage); } break; } case BRAIN_EVENT.ATTACKED_WEAK_POINT: { AttackedHitStatusOwner attackedHitStatusOwner = (AttackedHitStatusOwner)param; if (base.opponentMem != null) { int attackedWeakPointHate = base.opponentMem.hateParam.attackedWeakPointHate; OpponentMemory opponentMem = base.opponentMem; Vector3 val = attackedHitStatusOwner.fromPos - attackedHitStatusOwner.hitPos; DISTANCE distance = opponentMem.GetDistance(val.get_sqrMagnitude()); attackedWeakPointHate = (int)((float)attackedWeakPointHate * base.opponentMem.hateParam.distanceAttackRatio[(int)distance]); if (isNPC(attackedHitStatusOwner.fromObject)) { attackedWeakPointHate = (int)((float)attackedWeakPointHate * 0.5f); } base.opponentMem.AddHate(attackedHitStatusOwner.fromObject, attackedWeakPointHate, Hate.TYPE.SpecialDamage); } break; } case BRAIN_EVENT.PLAYER_HEAL: if (base.opponentMem != null) { Player.HateInfo hateInfo2 = param as Player.HateInfo; base.opponentMem.AddHate(hateInfo2.target, hateInfo2.val, Hate.TYPE.Heal); } break; case BRAIN_EVENT.PLAYER_SKILL: if (base.opponentMem != null) { base.opponentMem.AddHate(param as StageObject, base.opponentMem.hateParam.skillHate, Hate.TYPE.Skill); } break; case BRAIN_EVENT.REVIVE_REGION: if (actionCtrl != null) { actionCtrl.OnReviveRegion((int)param); } break; case BRAIN_EVENT.DECOY: if (base.opponentMem != null) { DecoyBulletObject.HateInfo hateInfo = param as DecoyBulletObject.HateInfo; base.opponentMem.AddHate(hateInfo.target, hateInfo.value, hateInfo.type); } break; case BRAIN_EVENT.WAVE_TARGET: if (base.opponentMem != null) { base.opponentMem.AddHate(param as StageObject, 1000, Hate.TYPE.Damage); } break; } base.HandleEvent(ev, param); }