2021-04-08 20:09:59 +08:00
|
|
|
|
using Cal.DataTable;
|
|
|
|
|
using ET.EventType;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public class BattleEndEvent : AEvent<BattleEnd>
|
|
|
|
|
{
|
|
|
|
|
public override async ETTask Run(BattleEnd args)
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
Unit unit = args.unit;
|
|
|
|
|
Team team = args.team;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
try
|
|
|
|
|
{
|
2021-05-01 11:27:41 +08:00
|
|
|
|
unit.GetComponent<TargetableUnitComponent>().Clear();
|
|
|
|
|
unit.GetComponent<AttackComponent>().Clear();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
//清理modifier
|
|
|
|
|
ModifierContainerComponent modifierContainerComponent = unit.GetComponent<ModifierContainerComponent>();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
if (unit.UnitType != UnitType.Player)
|
|
|
|
|
return;
|
2021-04-11 19:50:39 +08:00
|
|
|
|
BrocastComponent brocastComponent = unit.GetComponent<BrocastComponent>();
|
|
|
|
|
HashSet<long> aoi = brocastComponent.GetInternalAll();
|
|
|
|
|
using ListComponent<long> listComponent = ListComponent<long>.Create();
|
|
|
|
|
foreach (long u in aoi)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
if (!team.Contains(u))
|
|
|
|
|
listComponent.List.Add(u);
|
|
|
|
|
}
|
2021-04-11 19:50:39 +08:00
|
|
|
|
foreach (long item in listComponent.List)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
brocastComponent.RemoveInternal(item);
|
|
|
|
|
Log.Info($"{unit.Id}去除{item}");
|
|
|
|
|
}
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class BattleEnd_AddHpEvent : AEvent<EventType.BattleEnd_AddHp>
|
|
|
|
|
{
|
|
|
|
|
public override async ETTask Run(EventType.BattleEnd_AddHp args)
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
Unit unit = args.unit;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
PlayerData data = unit.GetComponent<PlayerData>();
|
2021-04-11 19:50:39 +08:00
|
|
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
AddHp(num, data);
|
|
|
|
|
AddMp(num, data);
|
|
|
|
|
UnitHelper.SaveComponenet(data).Coroutine();
|
|
|
|
|
UnitHelper.SaveComponenet(num).Coroutine();
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AddHp(NumericComponent num, PlayerData data)
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
KeyValuePair<int, int> hpKV = data.hpAutoFullCapatial;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
int hp = MathHelper.RoundToInt(hpKV.Value / 10000f * num.GetAsInt(NumericType.MaxHp)) - num.GetAsInt(NumericType.Hp);
|
|
|
|
|
if (hp < 0) hp = 0;
|
|
|
|
|
int capacity = hpKV.Key;
|
|
|
|
|
if (capacity <= 0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (hp > capacity)
|
|
|
|
|
{
|
|
|
|
|
hp = capacity;
|
|
|
|
|
}
|
|
|
|
|
capacity -= hp;
|
|
|
|
|
data.hpAutoFullCapatial = KeyValuePair.Create(capacity, hpKV.Value);
|
|
|
|
|
num.AddSet(NumericType.Hp, hp);
|
|
|
|
|
}
|
|
|
|
|
private void AddMp(NumericComponent num, PlayerData data)
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
KeyValuePair<int, int> hpKV = data.mpAutoFullCapatial;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
int mp = MathHelper.RoundToInt(hpKV.Value / 10000f * num.GetAsInt(NumericType.MaxMp) - num.GetAsInt(NumericType.Mp));
|
|
|
|
|
if (mp < 0) mp = 0;
|
|
|
|
|
int capacity = hpKV.Key;
|
|
|
|
|
if (capacity <= 0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (mp > capacity)
|
|
|
|
|
{
|
|
|
|
|
mp = capacity;
|
|
|
|
|
}
|
|
|
|
|
capacity -= mp;
|
|
|
|
|
data.mpAutoFullCapatial = KeyValuePair.Create(capacity, hpKV.Value);
|
|
|
|
|
num.AddSet(NumericType.Mp, mp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class BattleEnd_GetRewordEvent : AEvent<EventType.BattleEnd_Reword>
|
|
|
|
|
{
|
|
|
|
|
//15 8 5 3
|
2021-04-13 20:39:32 +08:00
|
|
|
|
private static readonly float[] expAddtionArr = { 0, 0.15f, 0.23f, 0.28f, 0.31f };
|
2021-04-08 20:09:59 +08:00
|
|
|
|
//20 13 8 5
|
2021-04-13 20:39:32 +08:00
|
|
|
|
private static readonly float[] coinAddtionArr = { 0, 0.20f, 0.33f, 0.41f, 0.46f };
|
2021-04-08 20:09:59 +08:00
|
|
|
|
|
|
|
|
|
private const float TeamLeaderAddExp = 1.2f;
|
|
|
|
|
public override async ETTask Run(EventType.BattleEnd_Reword args)
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
Unit unit = args.unit;
|
|
|
|
|
UnOrderMultiMap<long, (int, int)> rewordMap = args.rewordMap;
|
2021-05-01 11:27:41 +08:00
|
|
|
|
long configId = args.configid;
|
2021-04-11 19:50:39 +08:00
|
|
|
|
BattleType battleType = args.battleType;
|
2021-05-01 11:27:41 +08:00
|
|
|
|
if (configId == 0)
|
|
|
|
|
{
|
|
|
|
|
Log.Error($"configId == 0 where type is {battleType}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-04-08 20:09:59 +08:00
|
|
|
|
|
|
|
|
|
if (unit.UnitType != UnitType.Player)
|
|
|
|
|
return;
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
PlayerData playerData = unit.GetComponent<PlayerData>();
|
|
|
|
|
long now = TimeHelper.ClientNow();
|
2021-04-13 20:39:32 +08:00
|
|
|
|
if (playerData.BattleExpSpeed > 1 && playerData.battleExpSpeedLeastTime < now)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
playerData.BattleExpSpeed = 1;
|
|
|
|
|
UnitHelper.Save<PlayerData>(unit).Coroutine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (battleType)
|
|
|
|
|
{
|
|
|
|
|
default:
|
2021-05-01 11:27:41 +08:00
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType}");
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
case BattleType.TrialCopy:
|
2021-05-01 11:27:41 +08:00
|
|
|
|
TrialCopy trialCopy = TrialCopyCategory.Instance.Get(configId);
|
|
|
|
|
if (trialCopy == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} configId = {configId}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MonsterBase monsterBase = MonsterBaseCategory.Instance.Get(trialCopy.MonsterId);
|
|
|
|
|
if (monsterBase == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} MonsterId = {trialCopy.MonsterId}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
await TrialCopyHelper.GetReword(unit, monsterBase, rewordMap);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return;
|
|
|
|
|
case BattleType.MainStory:
|
2021-05-01 11:27:41 +08:00
|
|
|
|
MainStory mainStory = MainStoryCategory.Instance.Get(configId);
|
|
|
|
|
if (mainStory == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} configId = {configId}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
monsterBase = MonsterBaseCategory.Instance.Get(mainStory.Monster_1Arr[0].Monster_1_Id);
|
|
|
|
|
if (monsterBase == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} MonsterId = {mainStory.Monster_1Arr[0].Monster_1_Id}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
await MainStoryReward(unit, monsterBase, mainStory, rewordMap);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return;
|
2021-05-01 11:27:41 +08:00
|
|
|
|
case BattleType.IdleBattle:
|
|
|
|
|
mainStory = MainStoryCategory.Instance.Get(configId);
|
|
|
|
|
if (mainStory == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} configId = {configId}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
monsterBase = MonsterBaseCategory.Instance.Get(mainStory.Monster_1Arr[0].Monster_1_Id);
|
|
|
|
|
if (monsterBase == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} MonsterId = {mainStory.Monster_1Arr[0].Monster_1_Id}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
await BattleIdleReword(unit, monsterBase, mainStory,rewordMap);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return;
|
2021-05-01 11:27:41 +08:00
|
|
|
|
case BattleType.Boss:
|
|
|
|
|
BossBase bossBase = BossBaseCategory.Instance.Get(configId);
|
|
|
|
|
if (bossBase == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} configId = {configId}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
monsterBase = MonsterBaseCategory.Instance.Get(bossBase.MonsterId);
|
|
|
|
|
if (monsterBase == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} MonsterId = {bossBase.MonsterId}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await BossReword(unit, monsterBase, rewordMap);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return;
|
|
|
|
|
case BattleType.ManulEquip:
|
2021-05-01 11:27:41 +08:00
|
|
|
|
ManulEquipMonsterConfig manulEquipMonsterConfig =ManulEquipMonsterConfigCategory.Instance.Get(configId);
|
|
|
|
|
if (manulEquipMonsterConfig == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} configId = {configId}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
monsterBase = MonsterBaseCategory.Instance.Get(manulEquipMonsterConfig.MonsterId);
|
|
|
|
|
if (monsterBase == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} MonsterId = {manulEquipMonsterConfig.MonsterId}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await ManulEquipReward(unit, monsterBase, rewordMap);
|
|
|
|
|
return;
|
|
|
|
|
case BattleType.SpaceTravel:
|
|
|
|
|
SpaceTravelConfig spaceTravelConfig =SpaceTravelConfigCategory.Instance.Get(configId);
|
|
|
|
|
if (spaceTravelConfig == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} configId = {configId}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
monsterBase = MonsterBaseCategory.Instance.Get(spaceTravelConfig.MonsterIdArr[0]);
|
|
|
|
|
if (monsterBase == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} MonsterId = {spaceTravelConfig.MonsterIdArr[0]}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await SpaceTravelReward(unit, monsterBase, rewordMap);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return;
|
2021-05-05 13:36:19 +08:00
|
|
|
|
case BattleType.StarSoulCopy:
|
|
|
|
|
StarSoulCopyConfig soulCopyConfig =StarSoulCopyConfigCategory.Instance.Get(configId);
|
|
|
|
|
if (soulCopyConfig == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} configId = {configId}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
monsterBase = MonsterBaseCategory.Instance.Get(soulCopyConfig.MonsterIdArr[0]);
|
|
|
|
|
if (monsterBase == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} battle type is {battleType} MonsterId = {soulCopyConfig.MonsterIdArr[0]}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await StarSoulCopyReward(unit, monsterBase, rewordMap,soulCopyConfig);
|
|
|
|
|
return;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
private async ETTask MainStoryReward(Unit unit, MonsterBase monsterBase, MainStory mainStory,UnOrderMultiMap<long, (int, int)> rewordMap)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
//队长
|
|
|
|
|
float drop = 1;
|
|
|
|
|
float expAddtion = 1, coinAddtion = 1;
|
2021-04-11 19:50:39 +08:00
|
|
|
|
PlayerData playerData = unit.GetComponent<PlayerData>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
|
|
|
|
|
if (unit.IsTeamLeader && team.MemberCount > 1) expAddtion *= TeamLeaderAddExp;
|
|
|
|
|
int addtionIndex = team.MemberCount - 1;
|
|
|
|
|
expAddtion += expAddtionArr[addtionIndex];
|
|
|
|
|
coinAddtion += coinAddtionArr[addtionIndex];
|
|
|
|
|
Unit leader = team.GetLeader();
|
|
|
|
|
if (playerData.ForbidExp || (leader.isAI && (!playerData.HasMainstoryAITime() && !playerData.HasMainstoryVIPAITime())))
|
|
|
|
|
{
|
|
|
|
|
expAddtion = 0;
|
|
|
|
|
drop = 0;
|
|
|
|
|
}
|
|
|
|
|
if (mainStory != null && mainStory.Layer != 10) expAddtion /= 5f;
|
|
|
|
|
|
2021-04-11 19:50:39 +08:00
|
|
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
if (!unit.IsAlive)
|
|
|
|
|
{
|
|
|
|
|
expAddtion *= 0.5f;
|
|
|
|
|
drop *= 0.5f;
|
|
|
|
|
}
|
|
|
|
|
//!Exp
|
|
|
|
|
long exp = MathHelper.RoundToLong(monsterBase.Exp * playerData.BattleExpSpeed * expAddtion);
|
|
|
|
|
num.AddSet(NumericType.Exp, exp);
|
|
|
|
|
|
|
|
|
|
if (drop != 0)
|
|
|
|
|
{
|
2021-04-15 00:12:07 +08:00
|
|
|
|
M2C_SendReward rewardRet = new M2C_SendReward() ;
|
|
|
|
|
DropHelper.Drop(unit, playerData, BattleType.MainStory, monsterBase.Dropasubset, rewordMap, drop, "主线掉落", list:rewardRet.ItemList );
|
2021-04-08 20:09:59 +08:00
|
|
|
|
SendMessage(unit, num, rewardRet, exp, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UnitHelper.Save<Bag>(unit).Coroutine();
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
private async ETTask BattleIdleReword(Unit unit, MonsterBase monsterBase ,MainStory mainStory, UnOrderMultiMap<long, (int, int)> rewordMap)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
float expAddtion = 1, coinAddtion = 1;
|
|
|
|
|
float reduceDrop = 0.2f;
|
2021-04-11 19:50:39 +08:00
|
|
|
|
PlayerData playerData = unit.GetComponent<PlayerData>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
|
|
|
|
|
int addtionIndex = team.MemberCount - 1;
|
|
|
|
|
expAddtion += expAddtionArr[addtionIndex];
|
|
|
|
|
coinAddtion += coinAddtionArr[addtionIndex];
|
|
|
|
|
if (playerData.ForbidExp)
|
|
|
|
|
{
|
|
|
|
|
expAddtion = 0;
|
|
|
|
|
reduceDrop = 0;
|
|
|
|
|
}
|
|
|
|
|
//!经验铜币减半
|
|
|
|
|
float reduce = 0.7f;
|
|
|
|
|
expAddtion *= reduce;
|
|
|
|
|
|
2021-04-11 19:50:39 +08:00
|
|
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
if (!unit.IsAlive)
|
|
|
|
|
{
|
|
|
|
|
expAddtion *= 0.2f;
|
|
|
|
|
reduceDrop *= 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!playerData.ForbidExp)
|
|
|
|
|
{
|
|
|
|
|
float coin = ConstDefine.IdleBattleAddCoinArr.RandomArray_Len2();
|
|
|
|
|
int coinIndex = mainStory.SceneId - Sys_SceneId.Scene_MainStory1;
|
|
|
|
|
coin *= ConstDefine.MainstoryAddCoeconfident[coinIndex];
|
|
|
|
|
StatisticsHelper.AddInfo(unit.Id, StatisticComponent.StatisticType.Coin, StatisticsTypes.CoinSources_IdleBattle, (long)coin);
|
|
|
|
|
CharacterHelper.AddMoney(unit, CharacterHelper.MoneyType.Coin, (long)coin);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//!Exp
|
|
|
|
|
long exp = MathHelper.RoundToLong(monsterBase.Exp * playerData.BattleExpSpeed * expAddtion);
|
|
|
|
|
num.AddSet(NumericType.Exp, exp);
|
|
|
|
|
|
|
|
|
|
//if (reduceDrop != 0)
|
|
|
|
|
//{
|
|
|
|
|
// var rewardRet = Drop(unit, playerData, monsterBase.Dropasubset, rewordMap, reduceDrop, "挂机掉落");
|
|
|
|
|
// SendMessage(unit, num, rewardRet, exp, 0);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
private async ETTask BossReword(Unit unit, MonsterBase monsterBase, UnOrderMultiMap<long, (int, int)> rewordMap)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
|
|
|
|
|
int addtionIndex = team.MemberCount - 1;
|
|
|
|
|
float expAddtion = 1 + expAddtionArr[addtionIndex];
|
|
|
|
|
float coinAddtion = 1 + coinAddtionArr[addtionIndex];
|
|
|
|
|
|
|
|
|
|
if (!unit.IsAlive)
|
|
|
|
|
expAddtion /= 2;
|
2021-04-11 19:50:39 +08:00
|
|
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
|
|
|
|
PlayerData playerData = unit.GetComponent<PlayerData>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
//!Exp
|
|
|
|
|
long exp = MathHelper.RoundToLong(monsterBase.Exp * playerData.BattleExpSpeed * expAddtion);
|
|
|
|
|
num.AddSet(NumericType.Exp, exp);
|
|
|
|
|
|
2021-04-15 00:12:07 +08:00
|
|
|
|
M2C_SendReward rewardRet = new M2C_SendReward();
|
|
|
|
|
DropHelper.Drop(unit, playerData, BattleType.Boss, monsterBase.Dropasubset, rewordMap, 1, "Boss掉落", list:rewardRet.ItemList);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
SendMessage(unit, num, rewardRet, exp, 0);
|
|
|
|
|
}
|
2021-05-01 11:27:41 +08:00
|
|
|
|
private async ETTask ManulEquipReward(Unit unit,MonsterBase monsterBase, UnOrderMultiMap<long, (int, int)> rewordMap)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
await ETTask.CompletedTask;
|
2021-05-01 11:27:41 +08:00
|
|
|
|
float reduceDrop = 1;
|
|
|
|
|
if (!unit.IsAlive)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-05-01 11:27:41 +08:00
|
|
|
|
reduceDrop *= 0.3f;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
2021-05-01 11:27:41 +08:00
|
|
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
|
|
|
|
PlayerData playerData = unit.GetComponent<PlayerData>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
M2C_SendReward rewardRet = new M2C_SendReward();
|
2021-05-02 12:44:22 +08:00
|
|
|
|
DropHelper. Drop(unit, playerData, BattleType.ManulEquip, monsterBase.Dropasubset, rewordMap, reduceDrop, "手工副本掉落", true, list:rewardRet.ItemList);
|
2021-05-01 11:27:41 +08:00
|
|
|
|
SendMessage(unit, num, rewardRet, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
private async ETTask SpaceTravelReward(Unit unit,MonsterBase monsterBase, UnOrderMultiMap<long, (int, int)> rewordMap)
|
|
|
|
|
{
|
|
|
|
|
await ETTask.CompletedTask;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
float reduceDrop = 1;
|
|
|
|
|
if (!unit.IsAlive)
|
|
|
|
|
{
|
|
|
|
|
reduceDrop *= 0.3f;
|
|
|
|
|
}
|
2021-04-11 19:50:39 +08:00
|
|
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
|
|
|
|
PlayerData playerData = unit.GetComponent<PlayerData>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
|
2021-04-15 00:12:07 +08:00
|
|
|
|
M2C_SendReward rewardRet = new M2C_SendReward();
|
2021-05-02 12:44:22 +08:00
|
|
|
|
DropHelper. Drop(unit, playerData, BattleType.ManulEquip, monsterBase.Dropasubset, rewordMap, reduceDrop, "时空旅行掉落", false, list:rewardRet.ItemList);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
SendMessage(unit, num, rewardRet, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-05 13:36:19 +08:00
|
|
|
|
|
|
|
|
|
private async ETTask StarSoulCopyReward(Unit unit, MonsterBase monsterBase, UnOrderMultiMap<long, (int, int)> rewordMap,
|
|
|
|
|
StarSoulCopyConfig starSoulCopyConfig)
|
|
|
|
|
{
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
float reduceDrop = 1;
|
|
|
|
|
PlayerData playerData = unit.GetComponent<PlayerData>();
|
|
|
|
|
if (playerData.ForbidExp)
|
|
|
|
|
reduceDrop = 0;
|
|
|
|
|
if (!unit.IsAlive)
|
|
|
|
|
{
|
|
|
|
|
reduceDrop *= 0.3f;
|
|
|
|
|
}
|
|
|
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
|
|
|
|
|
|
|
|
|
if (reduceDrop == 0) return;
|
|
|
|
|
M2C_SendReward rewardRet = new M2C_SendReward();
|
|
|
|
|
DropHelper.Drop(unit, playerData, BattleType.ManulEquip, monsterBase.Dropasubset, rewordMap, reduceDrop, "星魂副本掉落", false, list:rewardRet.ItemList);
|
|
|
|
|
SendMessage(unit, num, rewardRet, 0, 0);
|
|
|
|
|
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
|
|
|
|
|
var leader = team.GetLeader();
|
|
|
|
|
if (!leader)
|
|
|
|
|
return;
|
|
|
|
|
StarSoulCopyConfigComponent soulCopyConfigComponent = leader.GetComponent<StarSoulCopyConfigComponent>();
|
|
|
|
|
byte difficulty = soulCopyConfigComponent.difficulty;
|
|
|
|
|
byte type = soulCopyConfigComponent.type;
|
|
|
|
|
int count = RandomHelper.RandomNumber(starSoulCopyConfig.StarSoulCountMin, starSoulCopyConfig.StarSoulCountMax+1);
|
|
|
|
|
StarSoulBag bag = unit.GetComponent<StarSoulBag>();
|
|
|
|
|
for (int i = 0; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
StarSoulItem item= ItemHelper.GenerateStarSoulItem(type, difficulty);
|
|
|
|
|
bag.Add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2021-04-13 20:39:32 +08:00
|
|
|
|
private static void SendMessage(Unit unit, NumericComponent num, M2C_SendReward rewardRet, long exp, long coin)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
|
2021-04-11 19:50:39 +08:00
|
|
|
|
M2C_SendBag bagRet = new M2C_SendBag();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
BagHelper.GetBagInfo(unit, bagRet.BagMapList);
|
|
|
|
|
MessageHelper.SendActor(unit, bagRet);
|
|
|
|
|
//!发送奖励信息
|
|
|
|
|
rewardRet.Exp = exp;
|
|
|
|
|
rewardRet.Coin = coin;
|
|
|
|
|
MessageHelper.SendActor(unit, rewardRet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|