689 lines
26 KiB
Plaintext
689 lines
26 KiB
Plaintext
/*
|
|
文件名:Equipment.nut
|
|
路径:User/Asset/Item/Equipment.nut
|
|
创建日期:2024-12-12 19:03
|
|
文件用途:
|
|
*/
|
|
//装备信息标签类(信息类)
|
|
if (!GameItem.rawin("EquipmentInfoTag")) GameItem.EquipmentInfoTag <- null;
|
|
//装备图标窗口
|
|
class GameItem.EquipmentIcon extends CL_CanvasObject {
|
|
|
|
constructor(Equipment) {
|
|
base.constructor();
|
|
ResizeAndClear(32, 32);
|
|
BeginDraw();
|
|
//构造图标 及图标边框
|
|
if (Equipment.Icon) {
|
|
//图标
|
|
local Icon = CL_SpriteFrameObject(Equipment.Icon.path, Equipment.Icon.index);
|
|
DrawSpriteFrame(Icon, 0, 0);
|
|
|
|
//是否封装
|
|
local IsPackage = Equipment.IsWrap;
|
|
if (IsPackage && (Equipment.Rarity == 2 || Equipment.Rarity == 3)) {
|
|
local IconFrame = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 634);
|
|
IconFrame.SetMode(0);
|
|
DrawSprite(IconFrame);
|
|
}
|
|
|
|
//边框
|
|
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + GameItem.EquipmentInfoTag.rarityframe_color_idx[Equipment.Rarity]);
|
|
DrawSpriteFrame(IconFrame, 0, 0);
|
|
}
|
|
EndDraw();
|
|
}
|
|
}
|
|
|
|
//装备信息窗口
|
|
class GameItem.EquipmentInfo extends Yosin_Window {
|
|
//装备
|
|
Equipment = null;
|
|
//画布
|
|
Canvas = null;
|
|
//画布实际高度
|
|
RealCanvasHeight = 0;
|
|
|
|
constructor(Equipment) {
|
|
this.Equipment = Equipment.weakref();
|
|
base.constructor(clock() + "EquipmentInfo" + Equipment.Idx, 0, 0, 0, 0, 0);
|
|
|
|
Init();
|
|
|
|
local background = Yosin_NineBoxStretch(211, RealCanvasHeight + 10, "sprite/interface/lenheartwindowcommon.img", 213);
|
|
background.SetZOrder(-1);
|
|
Addchild(background);
|
|
}
|
|
|
|
function Init() {
|
|
Canvas = CL_CanvasObject();
|
|
Canvas.ResizeAndClear(210, 600);
|
|
Canvas.SetFillBrush(sq_RGBA(59, 56, 57, 250));
|
|
Canvas.SetStrokeBrush(sq_RGBA(59, 56, 57, 250));
|
|
Canvas.BeginDraw();
|
|
|
|
//构造图标 及图标边框
|
|
if (Equipment.Icon) {
|
|
local Icon = GameItem.EquipmentIcon(Equipment);
|
|
Canvas.DrawActor(Icon, 7, 7);
|
|
}
|
|
|
|
//绘制装备名称
|
|
if (Equipment.Name.len() > 0) {
|
|
local UpgradeName = "";
|
|
local SeparateLevelName = "";
|
|
local DrawName = Equipment.Name;
|
|
if (Equipment.Upgrade > 0) UpgradeName = "+" + Equipment.Upgrade;
|
|
if (Equipment.SeparateLevel > 0) SeparateLevelName = "(" + Equipment.SeparateLevel + ")";
|
|
if ((Equipment.Upgrade + Equipment.SeparateLevel) > 0) DrawName = UpgradeName + SeparateLevelName + " " + DrawName;
|
|
local EquName = FontAssetManager.GenerateNormal(DrawName, false, {
|
|
color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity]
|
|
});
|
|
Canvas.DrawActor(EquName, 41, 7);
|
|
}
|
|
|
|
//绘制分割线
|
|
Canvas.DrawLine(3, 37, 207, 38);
|
|
|
|
//绘制品级
|
|
local Percentage = Equipment.Percentage;
|
|
//品级文字
|
|
local PercentageGradeText = FontAssetManager.GenerateNormal(GetPercentageText(Percentage), false, {
|
|
color = sq_RGBA(255, 240, 0, 255)
|
|
});
|
|
//百分比UI
|
|
local PercentageUI = CL_SpriteFrameObject("sprite/interface/lenheartwindowcommon.img", 633);
|
|
Canvas.DrawSpriteFrame(PercentageUI, 48, 49, PercentageUI.GetSize().w * (Percentage.tofloat() / 100.0));
|
|
local PercentageUIBG = CL_SpriteFrameObject("sprite/interface/lenheartwindowcommon.img", 632);
|
|
Canvas.DrawSpriteFrame(PercentageUIBG, 47, 48);
|
|
//百分比文字
|
|
local PercentageText = FontAssetManager.GenerateNormal(format("(%d%%)", Percentage), false, {
|
|
color = sq_RGBA(161, 131, 74, 255)
|
|
});
|
|
Canvas.DrawActor(PercentageGradeText, 6, 41);
|
|
Canvas.DrawActor(PercentageText, 130, 41);
|
|
//绘制稀有度名称
|
|
local RarityTagName = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.rarity_name_tag[Equipment.Rarity], false, {
|
|
color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity]
|
|
});
|
|
Canvas.DrawActor(RarityTagName, 210 - RarityTagName.GetSize().w - 6, 41);
|
|
|
|
//绘制重量
|
|
local WeightText = FontAssetManager.GenerateNormal((Equipment.Weight.tofloat() / 1000.0) + "kg", false, {
|
|
color = sq_RGBA(161, 131, 74, 255)
|
|
});
|
|
Canvas.DrawActor(WeightText, 6, 57);
|
|
|
|
//绘制最低多少级可以使用
|
|
local MinUseLevelText = FontAssetManager.GenerateNormal(Equipment.Minimum_level + "级以上可以使用", false, {
|
|
color = sq_RGBA(161, 131, 74, 255)
|
|
});
|
|
Canvas.DrawActor(MinUseLevelText, 210 - MinUseLevelText.GetSize().w - 6, 57);
|
|
|
|
//绘制交易类型 如果有主体属性读取 否则一律为封装
|
|
local TradeType = Equipment.TradeType;
|
|
local TradeTypeText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.trade_type_text[TradeType], false, {
|
|
color = GameItem.EquipmentInfoTag.trade_type_color[TradeType]
|
|
});
|
|
Canvas.DrawActor(TradeTypeText, 210 - TradeTypeText.GetSize().w - 6, 73);
|
|
|
|
//绘制装备类型
|
|
local GroupNameText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.item_group_name_table[Equipment.GroupName], false, {
|
|
color = sq_RGBA(194, 161, 56, 255)
|
|
});
|
|
Canvas.DrawActor(GroupNameText, 210 - GroupNameText.GetSize().w - 6, 89);
|
|
|
|
//绘制售价
|
|
local RealSellPrice = (Equipment.SellPrice == -1 ? (Equipment.Price == -1 ? 0 : Equipment.Price) : Equipment.SellPrice) / 5;
|
|
local SellPriceText = FontAssetManager.GenerateNormal(RealSellPrice + "金币", false, {
|
|
color = sq_RGBA(133, 121, 78, 255)
|
|
});
|
|
Canvas.DrawActor(SellPriceText, 210 - SellPriceText.GetSize().w - 6, 105);
|
|
|
|
//绘制耐久度
|
|
local DurabilityText = FontAssetManager.GenerateNormal("耐久度 " + (Equipment.CurrentDurability == -1 ? Equipment.Durability : Equipment.CurrentDurability) + "/" + Equipment.Durability, false, {
|
|
color = sq_RGBA(133, 121, 80, 255)
|
|
});
|
|
Canvas.DrawActor(DurabilityText, 6, 121);
|
|
|
|
//绘制分割线
|
|
Canvas.DrawLine(3, 139, 207, 139);
|
|
|
|
//下面的绘制逻辑开始使用行put来做
|
|
RealCanvasHeight = 141;
|
|
|
|
//绘制冒险家名望
|
|
local AdventurerFameFrame = CL_SpriteFrameObject("sprite/interface2/profile/profile_cn/profile_cn.img", 0);
|
|
Canvas.DrawSpriteFrame(AdventurerFameFrame, 6, RealCanvasHeight + 3);
|
|
local AdventurerFame = FontAssetManager.GenerateNormal("冒险家名望 " + Equipment.AdventurerFame, false, {
|
|
color = sq_RGBA(133, 121, 80, 255)
|
|
});
|
|
Canvas.DrawActor(AdventurerFame, 22, RealCanvasHeight);
|
|
|
|
//绘制分割
|
|
AddSliceLine();
|
|
|
|
//绘制强化和增幅逻辑
|
|
if ((Equipment.Upgrade + Equipment.SeparateLevel) > 0) {
|
|
local UpgradeInfo;
|
|
if (Equipment.Upgrade > 0) {
|
|
UpgradeInfo = FontAssetManager.GenerateNormal("+" + Equipment.Upgrade + " 强化 ,", false, {
|
|
color = sq_RGBA(103, 214, 236, 255)
|
|
});
|
|
Canvas.DrawActor(UpgradeInfo, 6, RealCanvasHeight);
|
|
}
|
|
if (Equipment.SeparateLevel > 0) {
|
|
local SeparateLevelInfo = FontAssetManager.GenerateNormal("+" + Equipment.SeparateLevel + " 锻造", false, {
|
|
color = sq_RGBA(180, 106, 254, 255)
|
|
});
|
|
Canvas.DrawActor(SeparateLevelInfo, UpgradeInfo ? UpgradeInfo.GetSize().w : 6, RealCanvasHeight);
|
|
}
|
|
AddHeight();
|
|
}
|
|
|
|
//绘制物理攻击力
|
|
DrawAttack("EquipmentPhysicalAttack", "物理攻击力");
|
|
//绘制魔法攻击力
|
|
DrawAttack("EquipmentMagicalAttack", "魔法攻击力");
|
|
//绘制独立攻击力
|
|
DrawAttack("SeparateAttack", "独立攻击力");
|
|
//绘制四维
|
|
DrawAttribute("PhysicalAttack", "力量");
|
|
DrawAttribute("MagicalAttack", "智力");
|
|
DrawAttribute("PhysicalDefense", "体力");
|
|
DrawAttribute("MagicalDefense", "精神");
|
|
//绘制分割
|
|
Canvas.DrawLine(3, RealCanvasHeight + 3, 207, RealCanvasHeight + 3);
|
|
RealCanvasHeight += 6;
|
|
|
|
//绘制三速
|
|
DrawSpeed("AttackSpeed", "攻击速度");
|
|
DrawSpeed("CastSpeed", "释放速度");
|
|
DrawSpeed("MoveSpeed", "移动速度");
|
|
|
|
//绘制双爆
|
|
DrawCritical("PhysicalCriticalHit", "物理暴击率");
|
|
DrawCritical("MagicalCriticalHit", "魔法暴击率");
|
|
|
|
//绘制命中率
|
|
DrawStuck("Stuck", "命中率");
|
|
|
|
//绘制四属抗
|
|
DrawElement("DarkResistance", "暗属性抗性");
|
|
DrawElement("LightResistance", "光属性抗性");
|
|
DrawElement("FireResistance", "火属性抗性");
|
|
DrawElement("WaterResistance", "水属性抗性");
|
|
|
|
//绘制四属强
|
|
DrawElement("DarkAttack", "暗属性强化");
|
|
DrawElement("LightAttack", "光属性强化");
|
|
DrawElement("FireAttack", "火属性强化");
|
|
DrawElement("WaterAttack", "水属性强化");
|
|
|
|
//绘制属性攻击
|
|
if (Equipment.ElementalProperty) {
|
|
local Text = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.elemental_property_tag[Equipment.ElementalProperty], false, {
|
|
color = sq_RGBA(215, 196, 147, 255)
|
|
});
|
|
Canvas.DrawActor(Text, 6, RealCanvasHeight);
|
|
AddHeight();
|
|
}
|
|
|
|
|
|
//绘制描述
|
|
if (Equipment.FlavorText) {
|
|
//绘制分割
|
|
Canvas.DrawLine(3, RealCanvasHeight + 3, 207, RealCanvasHeight + 3);
|
|
RealCanvasHeight += 6;
|
|
|
|
local Text = FontAssetManager.GenerateNormal(Equipment.FlavorText, false, {
|
|
color = sq_RGBA(133, 121, 80, 255),
|
|
wrap_width = 204
|
|
});
|
|
Canvas.DrawActor(Text, 6, RealCanvasHeight);
|
|
RealCanvasHeight += Text.GetSize().h;
|
|
}
|
|
|
|
Canvas.EndDraw();
|
|
Addchild(Canvas);
|
|
}
|
|
|
|
//绘制属强属抗
|
|
function DrawElement(Type, TypeName) {
|
|
if (Equipment[Type] != 0) {
|
|
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + (Equipment[Type] >= 0 ? "+" : "-") + Equipment[Type], false, {
|
|
color = sq_RGBA(215, 196, 147, 255)
|
|
});
|
|
Canvas.DrawActor(AttackText, 6, RealCanvasHeight);
|
|
AddHeight();
|
|
}
|
|
}
|
|
|
|
//绘制命中
|
|
function DrawStuck(Type, TypeName) {
|
|
if (Equipment[Type] != 0) {
|
|
local Value = Equipment[Type];
|
|
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + (Value >= 0 ? "+" : "") + Value + "%", false, {
|
|
color = sq_RGBA(215, 196, 147, 255)
|
|
});
|
|
Canvas.DrawActor(AttackText, 6, RealCanvasHeight);
|
|
AddHeight();
|
|
}
|
|
}
|
|
|
|
//绘制双爆
|
|
function DrawCritical(Type, TypeName) {
|
|
if (Equipment[Type] != 0) {
|
|
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + (Equipment[Type] >= 0 ? "+" : "-") + Equipment[Type] + "%", false, {
|
|
color = sq_RGBA(215, 196, 147, 255)
|
|
});
|
|
Canvas.DrawActor(AttackText, 6, RealCanvasHeight);
|
|
AddHeight();
|
|
}
|
|
}
|
|
|
|
//绘制三速
|
|
function DrawSpeed(Type, TypeName) {
|
|
if (Equipment[Type] != 0) {
|
|
local Value = (Equipment[Type].tofloat() * 0.1).tointeger();
|
|
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + (Value >= 0 ? "+" : "-") + Value + "%", false, {
|
|
color = sq_RGBA(215, 196, 147, 255)
|
|
});
|
|
Canvas.DrawActor(AttackText, 6, RealCanvasHeight);
|
|
AddHeight();
|
|
}
|
|
}
|
|
|
|
//绘制四维
|
|
function DrawAttribute(Type, TypeName) {
|
|
if (Equipment[Type] != 0) {
|
|
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + Equipment[Type], false, {
|
|
color = sq_RGBA(134, 120, 79, 255)
|
|
});
|
|
Canvas.DrawActor(AttackText, 6, RealCanvasHeight);
|
|
AddHeight();
|
|
}
|
|
}
|
|
|
|
//绘制三攻
|
|
function DrawAttack(Type, TypeName) {
|
|
if (Equipment[Type] != null) {
|
|
local RealValue;
|
|
//数组为没有百分比计算过的原始数据
|
|
if (typeof Equipment[Type] == "array") {
|
|
local MaxValue = Equipment[Type][0];
|
|
local MinValue = Equipment[Type][1];
|
|
local Rate = 1.0;
|
|
RealValue = (MinValue + ((MaxValue - MinValue).tofloat() * Rate).tointeger());
|
|
}
|
|
//百分比计算过的数据
|
|
else if (typeof Equipment[Type] == "integer" || typeof Equipment[Type] == "float") {
|
|
RealValue = Equipment[Type];
|
|
}
|
|
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + RealValue, false, {
|
|
color = sq_RGBA(134, 120, 79, 255)
|
|
});
|
|
Canvas.DrawActor(AttackText, 6, RealCanvasHeight);
|
|
AddHeight();
|
|
}
|
|
}
|
|
|
|
//增加行高
|
|
function AddHeight() {
|
|
RealCanvasHeight += 16;
|
|
}
|
|
//增加分割行
|
|
function AddSliceLine() {
|
|
RealCanvasHeight += 18;
|
|
Canvas.DrawLine(3, RealCanvasHeight, 207, RealCanvasHeight);
|
|
RealCanvasHeight += 2;
|
|
}
|
|
|
|
// 根据数值获取对应的品级文字
|
|
function GetPercentageText(num) {
|
|
if (num< GameItem.EquipmentInfoTag.percentage_range_boundaries[0]) {
|
|
return GameItem.EquipmentInfoTag.percentage_text[0];
|
|
}
|
|
for (local i = 0; i< GameItem.EquipmentInfoTag.percentage_range_boundaries.len(); i++) {
|
|
if (num <= GameItem.EquipmentInfoTag.percentage_range_boundaries[i]) {
|
|
return GameItem.EquipmentInfoTag.percentage_text[i + 1];
|
|
}
|
|
}
|
|
return GameItem.EquipmentInfoTag.percentage_text.top();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// if (!getroottable().rawin("chongzaiflag")) {
|
|
// getroottable()["chongzaiflag"] <- true;
|
|
// } else {
|
|
// //遍历窗口队列 如果可见则调用Show
|
|
// for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
|
// local Window = _SYS_WINDOW_LIST_[i];
|
|
// Window.Visible = false;
|
|
// Window.RemoveSelf();
|
|
// }
|
|
// TestStage();
|
|
// }
|
|
|
|
|
|
|
|
class GameItem.Equipment extends GameItem.Item {
|
|
//装备ID
|
|
Idx = -1;
|
|
//装备名称
|
|
Name = "";
|
|
//强化或增幅等级
|
|
Upgrade = 0;
|
|
//锻造等级
|
|
SeparateLevel = 0;
|
|
//增幅属性 0 无 1 力量 2 智力 3 体力 4 精神
|
|
EquipIncrease = 0;
|
|
//是否封装
|
|
IsWrap = 0;
|
|
//在封装次数
|
|
WrapCount = 0;
|
|
//交易类型
|
|
TradeType = 0;
|
|
//装备类型
|
|
Type = -1;
|
|
//装备槽位
|
|
SlotType = -1;
|
|
//装备可穿戴等级
|
|
Minimum_level = -1;
|
|
//装备等级组
|
|
Grade = null;
|
|
//装备稀有度
|
|
Rarity = 0;
|
|
//重量
|
|
Weight = 0;
|
|
//装备组名
|
|
GroupName = "null";
|
|
//购买价格
|
|
Price = -1;
|
|
//维修价格
|
|
RepairPrice = -1;
|
|
//出售价格
|
|
SellPrice = -1;
|
|
//耐久度
|
|
Durability = -1;
|
|
//当前耐久度
|
|
CurrentDurability = -1;
|
|
//装备品质
|
|
Percentage = 100;
|
|
//冒险家名望
|
|
AdventurerFame = 0;
|
|
//装备可穿戴职业
|
|
Job = 0;
|
|
//装备图标
|
|
Icon = null;
|
|
//动画
|
|
Animation_Job = null;
|
|
//装备描述
|
|
Description = "";
|
|
//文件路径
|
|
DirPath = null;
|
|
//光环特效
|
|
Aurora_effects = null;
|
|
|
|
//装备属性
|
|
Property = null;
|
|
|
|
//力量
|
|
PhysicalAttack = 0;
|
|
//智力
|
|
MagicalAttack = 0;
|
|
//体力
|
|
PhysicalDefense = 0;
|
|
//精神
|
|
MagicalDefense = 0;
|
|
//所有属强
|
|
AllElementalAttack = 0;
|
|
//暗属强
|
|
DarkAttack = 0;
|
|
//光属强
|
|
LightAttack = 0;
|
|
//水属强
|
|
WaterAttack = 0;
|
|
//火属强
|
|
FireAttack = 0;
|
|
|
|
//物理攻击力
|
|
EquipmentPhysicalAttack = 0;
|
|
//魔法攻击力
|
|
EquipmentMagicalAttack = 0;
|
|
//独立攻击力
|
|
SeparateAttack = 0;
|
|
//物理防御力
|
|
EquipmentPhysicalDefense = 0;
|
|
//魔法防御力
|
|
EquipmentMagicalDefense = 0;
|
|
|
|
//攻击速度
|
|
AttackSpeed = 0;
|
|
//释放速度
|
|
CastSpeed = 0;
|
|
//移动速度
|
|
MoveSpeed = 0;
|
|
|
|
//物理暴击率
|
|
PhysicalCriticalHit = 0;
|
|
//魔法暴击率
|
|
MagicalCriticalHit = 0;
|
|
//命中率
|
|
Stuck = 0;
|
|
|
|
//暗属抗
|
|
DarkResistance = 0;
|
|
//光属抗
|
|
LightResistance = 0;
|
|
//水属抗
|
|
WaterResistance = 0;
|
|
//火属抗
|
|
FireResistance = 0;
|
|
|
|
//属性攻击
|
|
ElementalProperty = null;
|
|
|
|
//描述
|
|
FlavorText = null;
|
|
|
|
|
|
function _typeof() {
|
|
return "Equipment";
|
|
}
|
|
|
|
constructor(...) {
|
|
//直接裸构造
|
|
if (vargv.len() == 0) {
|
|
|
|
}
|
|
//通过参数构造
|
|
else if (vargv.len() == 1) {
|
|
local EquInfo;
|
|
//通过ID构造
|
|
if (typeof vargv[0] == "integer") {
|
|
EquInfo = AssetManager.GetEquipment(vargv[0]);
|
|
Idx = vargv[0];
|
|
ConstructEquipmentFromScript(EquInfo);
|
|
}
|
|
//通过Table来构造
|
|
else if (typeof vargv[0] == "table") {
|
|
local Info = vargv[0];
|
|
EquInfo = AssetManager.GetEquipment(Info.EquipId);
|
|
Idx = Info.EquipId;
|
|
ConstructEquipmentFromScript(EquInfo);
|
|
IterateEquipmentBasedOnActualEquipmentInformation(Info);
|
|
}
|
|
}
|
|
}
|
|
|
|
//根据装备实际信息迭代装备
|
|
function IterateEquipmentBasedOnActualEquipmentInformation(Info) {
|
|
//装备附魔 //TODO
|
|
//装备强化等级或增幅等级
|
|
this.Upgrade = Info.EquipUpgrade;
|
|
//装备锻造等级
|
|
this.SeparateLevel = Info.EquipSeparate;
|
|
//装备增幅属性
|
|
this.EquipIncrease = Info.EquipIncrease;
|
|
//装备力量百分比
|
|
this.PhysicalAttack *= (Info.EquipPowerPercentage.tofloat() / 100.0);
|
|
//装备智力百分比
|
|
this.MagicalAttack *= (Info.EquipIntellectPercentage.tofloat() / 100.0);
|
|
//装备体力百分比
|
|
this.PhysicalDefense *= (Info.EquipStaminaPercentage.tofloat() / 100.0);
|
|
//装备精神百分比
|
|
this.MagicalDefense *= (Info.EquipSpiritPercentage.tofloat() / 100.0);
|
|
|
|
//装备物理攻击百分比
|
|
this.EquipmentPhysicalAttack = this.EquipmentPhysicalAttack[0] + ((this.EquipmentPhysicalAttack[1] - this.EquipmentPhysicalAttack[0]) * (Info.EquipPhysicalAttackPercentage.tofloat() / 100.0));
|
|
//装备魔法攻击百分比
|
|
this.EquipmentMagicalAttack = this.EquipmentMagicalAttack[0] + ((this.EquipmentMagicalAttack[1] - this.EquipmentMagicalAttack[0]) * (Info.EquipMagicAttackPercentage.tofloat() / 100.0));
|
|
//装备独立攻击百分比
|
|
this.SeparateAttack = this.SeparateAttack[0] + ((this.SeparateAttack[1] - this.SeparateAttack[0]) * (Info.EquipIndependentAttackPercentage.tofloat() / 100.0));
|
|
//装备物理防御百分比
|
|
this.EquipmentPhysicalDefense = this.EquipmentPhysicalDefense[0] + ((this.EquipmentPhysicalDefense[1] - this.EquipmentPhysicalDefense[0]) * (Info.EquipPhysicalDefensePercentage.tofloat() / 100.0));
|
|
//装备魔法防御百分比
|
|
this.EquipmentMagicalDefense = this.EquipmentMagicalDefense[0] + ((this.EquipmentMagicalDefense[1] - this.EquipmentMagicalDefense[0]) * (Info.EquipMagicDefensePercentage.tofloat() / 100.0));
|
|
|
|
//装备全属强
|
|
this.AllElementalAttack += Info.EquipAllElementalAttack;
|
|
//装备水属强
|
|
this.WaterAttack += Info.EquipWaterAttack;
|
|
//装备火属强
|
|
this.FireAttack += Info.EquipFireAttack;
|
|
//装备光属强
|
|
this.LightAttack += Info.EquipLightAttack;
|
|
//装备暗属强
|
|
this.DarkAttack += Info.EquipDarkAttack;
|
|
//装备品质
|
|
this.Percentage = Info.EquipPercentage;
|
|
//装备再封装次数
|
|
this.WrapCount = Info.EquipWrapCount;
|
|
//装备是否封装
|
|
this.IsWrap = Info.EquipIsWrap;
|
|
//耐久度
|
|
this.CurrentDurability = Info.EquipDurability;
|
|
//交易类型
|
|
this.TradeType = Info.EquipTradeType;
|
|
}
|
|
|
|
//根据装备脚本信息构造装备
|
|
function ConstructEquipmentFromScript(EquInfo) {
|
|
//如果获取到对应的装备脚本信息
|
|
if (EquInfo) {
|
|
//名称
|
|
if (EquInfo.rawin("name")) Name = EquInfo["name"];
|
|
//类型
|
|
if (EquInfo.rawin("type")) GetRealEquipmentType(EquInfo["type"].path);
|
|
//最低使用等级
|
|
if (EquInfo.rawin("minimum level")) Minimum_level = EquInfo["minimum level"];
|
|
//等级组
|
|
if (EquInfo.rawin("grade")) Grade = EquInfo["grade"];
|
|
//稀有度
|
|
if (EquInfo.rawin("rarity")) Rarity = EquInfo["rarity"];
|
|
//重量
|
|
if (EquInfo.rawin("weight")) Weight = EquInfo["weight"];
|
|
//组名
|
|
if (EquInfo.rawin("item group name")) GroupName = EquInfo["item group name"];
|
|
//购买价格
|
|
if (EquInfo.rawin("price")) Price = EquInfo["price"];
|
|
//维修价格
|
|
if (EquInfo.rawin("repair price")) RepairPrice = EquInfo["repair price"];
|
|
//出售价格
|
|
if (EquInfo.rawin("value")) SellPrice = EquInfo["value"];
|
|
//耐久度
|
|
if (EquInfo.rawin("durability")) Durability = EquInfo["durability"];
|
|
//冒险家名望
|
|
if (EquInfo.rawin("adventurerfame")) AdventurerFame = EquInfo["adventurerfame"];
|
|
//职业
|
|
if (EquInfo.rawin("usable_job")) Job = EquInfo["usable_job"];
|
|
//图标
|
|
if (EquInfo.rawin("icon")) Icon = EquInfo["icon"];
|
|
if (EquInfo.rawin("Ani")) Animation_Job = EquInfo["Ani"];
|
|
if (EquInfo.rawin("DirPath")) DirPath = EquInfo["DirPath"];
|
|
if (EquInfo.rawin("aurora_effects")) Aurora_effects = EquInfo["aurora_effects"];
|
|
|
|
//四维
|
|
if (EquInfo.rawin("physical attack")) PhysicalAttack = EquInfo["physical attack"];
|
|
if (EquInfo.rawin("magical attack")) MagicalAttack = EquInfo["magical attack"];
|
|
if (EquInfo.rawin("physical defense")) PhysicalDefense = EquInfo["physical defense"];
|
|
if (EquInfo.rawin("magical defense")) MagicalDefense = EquInfo["magical defense"];
|
|
//属强
|
|
if (EquInfo.rawin("all elemental attack")) AllElementalAttack = EquInfo["all elemental attack"];
|
|
if (EquInfo.rawin("dark attack")) DarkAttack = EquInfo["dark attack"];
|
|
if (EquInfo.rawin("light attack")) LightAttack = EquInfo["light attack"];
|
|
if (EquInfo.rawin("water attack")) WaterAttack = EquInfo["water attack"];
|
|
if (EquInfo.rawin("fire attack")) FireAttack = EquInfo["fire attack"];
|
|
//三攻
|
|
if (EquInfo.rawin("equipment physical attack")) EquipmentPhysicalAttack = EquInfo["equipment physical attack"];
|
|
else EquipmentPhysicalAttack = [0, 0];
|
|
if (EquInfo.rawin("equipment magical attack")) EquipmentMagicalAttack = EquInfo["equipment magical attack"];
|
|
else EquipmentMagicalAttack = [0, 0];
|
|
if (EquInfo.rawin("separate attack")) SeparateAttack = EquInfo["separate attack"];
|
|
else SeparateAttack = [0, 0];
|
|
//物理防御和魔法防御
|
|
if (EquInfo.rawin("equipment physical defense")) EquipmentPhysicalDefense = EquInfo["equipment physical defense"];
|
|
else EquipmentPhysicalDefense = [0, 0];
|
|
if (EquInfo.rawin("equipment magical defense")) EquipmentMagicalDefense = EquInfo["equipment magical defense"];
|
|
else EquipmentMagicalDefense = [0, 0];
|
|
//三速
|
|
if (EquInfo.rawin("attack speed")) AttackSpeed = EquInfo["attack speed"];
|
|
if (EquInfo.rawin("cast speed")) CastSpeed = EquInfo["cast speed"];
|
|
if (EquInfo.rawin("move speed")) MoveSpeed = EquInfo["move speed"];
|
|
//双暴
|
|
if (EquInfo.rawin("physical critical hit")) PhysicalCriticalHit = EquInfo["physical critical hit"];
|
|
if (EquInfo.rawin("magical critical hit")) MagicalCriticalHit = EquInfo["magical critical hit"];
|
|
//命中率
|
|
if (EquInfo.rawin("stuck")) Stuck = -EquInfo["stuck"];
|
|
//四属抗
|
|
if (EquInfo.rawin("dark resistance")) DarkResistance = EquInfo["dark resistance"];
|
|
if (EquInfo.rawin("light resistance")) LightResistance = EquInfo["light resistance"];
|
|
if (EquInfo.rawin("water resistance")) WaterResistance = EquInfo["water resistance"];
|
|
if (EquInfo.rawin("fire resistance")) FireResistance = EquInfo["fire resistance"];
|
|
//属性攻击
|
|
if (EquInfo.rawin("elemental property")) ElementalProperty = EquInfo["elemental property"];
|
|
//描述
|
|
if (EquInfo.rawin("flavor text")) FlavorText = EquInfo["flavor text"];
|
|
} else error("没有对应的装备信息");
|
|
}
|
|
|
|
//设置真实装备类型
|
|
function SetRealEquipmentType(AType, BType) {
|
|
SlotType = AType;
|
|
Type = BType;
|
|
}
|
|
//获取真实装备类型
|
|
function GetRealEquipmentType(EType) {
|
|
if (EType == "skin avatar") SetRealEquipmentType("skin", "avatar");
|
|
else if (EType == "weapon") SetRealEquipmentType("weapon", "equipment");
|
|
else if (EType == "hat avatar") SetRealEquipmentType("hat", "avatar");
|
|
else if (EType == "hair avatar") SetRealEquipmentType("hair", "avatar");
|
|
else if (EType == "coat avatar") SetRealEquipmentType("coat", "avatar");
|
|
else if (EType == "pants avatar") SetRealEquipmentType("pants", "avatar");
|
|
else if (EType == "waist avatar") SetRealEquipmentType("waist", "avatar");
|
|
else if (EType == "shoes avatar") SetRealEquipmentType("shoes", "avatar");
|
|
else if (EType == "breast avatar") SetRealEquipmentType("breast", "avatar");
|
|
else if (EType == "face avatar") SetRealEquipmentType("face", "avatar");
|
|
else if (EType == "aurora avatar") SetRealEquipmentType("aurora", "aurora");
|
|
}
|
|
|
|
//穿戴装备回调
|
|
function OnWearStart() {
|
|
|
|
}
|
|
|
|
//穿戴时
|
|
function OnWearProc(Dt) {
|
|
|
|
}
|
|
|
|
//卸载时
|
|
function OnWearEnd() {
|
|
|
|
}
|
|
|
|
|
|
} |