//------------------------------------------------------------------------------
//
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
namespace G
{
using System.Collections.Generic;
using CodeStage.AntiCheat.ObscuredTypes;
///
/// Generated from: kungfu.xlsx
///
public partial class ItemKungfu
{
#region Field
///
///
///
private ObscuredInt _grade = 0;
///
/// 当前等级
///
public int grade
{
get => _grade;
set
{
if (value > 0 && value <= maxLevel)
{
_grade = value;
}
}
}
///
/// 等级上限
///
public int gradeMax => maxLevel;
public bool isMaxGrade
{
get { return _grade >= maxLevel; }
}
///
///
///
public Item.ItemInfo upgradePrice
{
get
{
return new Item.ItemInfo
{
id = cost[0],
count = cost[1] + (_grade - 1) * cost[2],
};
}
}
///
///
///
///
public void GetAttributes(List results)
{
int count = initValue.Length / 3;
for (int i = 0; i < count; i++)
{
int index = i * 3;
results.Add(new CombatAttribute
{
id = (CombatAttributeId)initValue[index],
value = _grade > 0 ? initValue[index + 1] + (_grade - 1) * initValue[index + 2] : initValue[index + 1]
});
}
}
public void GetNextAttributes(List results)
{
int count = initValue.Length / 3;
for (int i = 0; i < count; i++)
{
int index = i * 3;
results.Add(new CombatAttribute
{
id = (CombatAttributeId)initValue[index],
value = _grade > 0 ? initValue[index + 1] + _grade * initValue[index + 2] : initValue[index + 1]
});
}
}
public override string ToString()
{
string result = this.description;
var results = F.ListPool.Get();
GetAttributes(results);
if (results.Count == 1)
{
result = results[0].ToString();
}
else if (results.Count == 2)
{
result = results[0].ToString() + "\n" + results[1].ToString();
}
F.ListPool.Release(results);
return result;
}
public string ToString2()
{
string result = this.description;
var results = F.ListPool.Get();
GetAttributes(results);
if (results.Count == 1)
{
var text = results[0].ToString();
results.Clear();
GetNextAttributes(results);
result = text + $"+{results[0].value}";
}
else if (results.Count == 2)
{
var text = results[0].ToString();
var text2 = results[1].ToString();
results.Clear();
GetNextAttributes(results);
result = text + $"+{results[0].value}" + "\n" +
text2 + $"+{results[1].value}";
}
F.ListPool.Release(results);
return result;
}
#endregion
#region Method
public bool AddGrade()
{
if (_grade < maxLevel)
{
_grade++;
return true;
}
return false;
}
public override void Reset()
{
_grade = 0;
}
#endregion
}
}