110 lines
3.1 KiB
C#
110 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
using System.Text;
|
|
using Thousandto.Cfg.Data;
|
|
|
|
namespace Thousandto.Code.Logic
|
|
{
|
|
//战斗力计算系统
|
|
public class FightPowerHelper
|
|
{
|
|
public static uint GetPropetryPower( Dictionary<int, ulong> table )
|
|
{
|
|
float power = 0;
|
|
var ptr = table.GetEnumerator();
|
|
try
|
|
{
|
|
while (ptr.MoveNext())
|
|
{
|
|
var value = ptr.Current;
|
|
float param = 0.0f;
|
|
var item = DeclareAttributeAdd.Get(value.Key);
|
|
if(item != null)
|
|
{
|
|
param = item.Variable;
|
|
}
|
|
power += value.Value * (param / 10000f);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
ptr.Dispose();
|
|
}
|
|
return ( uint )power;
|
|
}
|
|
|
|
public static uint GetPropetryPower(Dictionary<int, int> table)
|
|
{
|
|
float power = 0;
|
|
var ptr = table.GetEnumerator();
|
|
try
|
|
{
|
|
while (ptr.MoveNext())
|
|
{
|
|
var value = ptr.Current;
|
|
float param = 0.0f;
|
|
var item = DeclareAttributeAdd.Get(value.Key);
|
|
if (item != null)
|
|
{
|
|
param = item.Variable;
|
|
}
|
|
power += value.Value * (param / 10000f);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
ptr.Dispose();
|
|
}
|
|
return (uint)power;
|
|
}
|
|
|
|
public static uint GetPropetryPower(List<AttribuiteData> attrList)
|
|
{
|
|
float power = 0;
|
|
try
|
|
{
|
|
for (int i = 0; i < attrList.Count; ++i)
|
|
{
|
|
var attrData = attrList[i];
|
|
float param = 0.0f;
|
|
var item = DeclareAttributeAdd.Get(attrData.AttrId);
|
|
if (item != null)
|
|
{
|
|
param = item.Variable;
|
|
}
|
|
power += attrData.AttrValue * (param / 10000f);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
}
|
|
return (uint)power;
|
|
}
|
|
|
|
public static uint GetPropetryPower(Dictionary<int, AttribuiteData> attrDict)
|
|
{
|
|
float power = 0;
|
|
var ptr = attrDict.GetEnumerator();
|
|
try
|
|
{
|
|
while (ptr.MoveNext())
|
|
{
|
|
var attrData = ptr.Current.Value;
|
|
float param = 0.0f;
|
|
var item = DeclareAttributeAdd.Get(attrData.AttrId);
|
|
if (item != null)
|
|
{
|
|
param = item.Variable;
|
|
}
|
|
power += attrData.AttrValue * (param / 10000f);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
}
|
|
return (uint)power;
|
|
}
|
|
}
|
|
}
|