유닛 레벨 계산식 추가
This commit is contained in:
parent
1c64863a1a
commit
8cf05ebad8
|
|
@ -215,10 +215,18 @@ public class DeckUnitInfo
|
|||
public long equip3_id { get; set; }
|
||||
public long equip4_id { get; set; }
|
||||
public long equip5_id { get; set; }
|
||||
[JsonIgnore]
|
||||
public int level { get; set; }
|
||||
[JsonIgnore]
|
||||
public long saveExp { get; set; }
|
||||
public long exp { get; set; }
|
||||
[JsonIgnore]
|
||||
public int rating { get; set; }
|
||||
[JsonIgnore]
|
||||
public long saveCount { get; set; }
|
||||
public long count { get; set; }
|
||||
|
||||
public void Update(DeckUnitInfo item)
|
||||
public DeckUnitInfo Update(DeckUnitInfo item)
|
||||
{
|
||||
this.equip0_id = item.equip0_id;
|
||||
this.equip1_id = item.equip1_id;
|
||||
|
|
@ -226,8 +234,20 @@ public class DeckUnitInfo
|
|||
this.equip3_id = item.equip3_id;
|
||||
this.equip4_id = item.equip4_id;
|
||||
this.equip5_id = item.equip5_id;
|
||||
this.level = item.level;
|
||||
this.exp = item.exp;
|
||||
this.count = item.count;
|
||||
return this;
|
||||
}
|
||||
public void Update(long exp, int level, long count, int rating)
|
||||
{
|
||||
if (exp != 0)
|
||||
this.saveExp = exp;
|
||||
if (level != 0)
|
||||
this.level = level;
|
||||
if (rating != 0)
|
||||
this.rating = rating;
|
||||
if (count != 0)
|
||||
this.saveCount = count;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ public class ItemBox
|
|||
public List<EtcItem> etcItem { get { return _etcItem; } }
|
||||
public ItemBox(List<DeckUnitInfo> deckUnitInfo, List<Equipment> equipment, List<ConsumableItem> consumableItem, List<EtcItem> etcItem)
|
||||
{
|
||||
//아이템 세팅
|
||||
|
||||
if (deckUnitInfo == null)
|
||||
_deckUnitInfo = new List<DeckUnitInfo>();
|
||||
else
|
||||
|
|
@ -42,6 +44,38 @@ public class ItemBox
|
|||
_etcItem = new List<EtcItem>();
|
||||
else
|
||||
_etcItem = etcItem.OrderBy(n => n.id).ToList();
|
||||
|
||||
//유닛 경험치 세팅
|
||||
foreach(DeckUnitInfo item in _deckUnitInfo)
|
||||
{
|
||||
UpdateUnitSpec(item);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 유닛 스팩 업데이트
|
||||
/// </summary>
|
||||
public void UpdateUnitSpec(DeckUnitInfo unit)
|
||||
{
|
||||
long saveExp = unit.exp;
|
||||
long defaultExp = 1024;
|
||||
long saveCount = unit.count;
|
||||
long defaultCount = 4;
|
||||
int level = 1;
|
||||
int rating = 0;
|
||||
while(saveExp > defaultExp)
|
||||
{
|
||||
saveExp -= defaultExp;
|
||||
defaultExp = (long)(1.2f * defaultExp);
|
||||
level++;
|
||||
}
|
||||
while (saveCount > defaultCount)
|
||||
{
|
||||
saveCount -= defaultCount;
|
||||
defaultCount = 2 * defaultCount;
|
||||
rating++;
|
||||
}
|
||||
unit.Update(saveExp, level, saveCount, rating);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -94,7 +128,7 @@ public class ItemBox
|
|||
/// <param name="item"></param>
|
||||
public void UpdateDeckUnitInfo(DeckUnitInfo item)
|
||||
{
|
||||
FindDeckUnitInfo(item.id).Update(item);
|
||||
UpdateUnitSpec(FindDeckUnitInfo(item.id).Update(item));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue