parent
90ad7fee5f
commit
b4f6e58f07
|
@ -262,6 +262,7 @@ end
|
||||||
|
|
||||||
function GetSkillData(skill_name)
|
function GetSkillData(skill_name)
|
||||||
local skill = Fk.skills[skill_name]
|
local skill = Fk.skills[skill_name]
|
||||||
|
if not skill then return "null" end
|
||||||
local freq = "notactive"
|
local freq = "notactive"
|
||||||
if skill:isInstanceOf(ActiveSkill) or skill:isInstanceOf(ViewAsSkill) then
|
if skill:isInstanceOf(ActiveSkill) or skill:isInstanceOf(ViewAsSkill) then
|
||||||
freq = "active"
|
freq = "active"
|
||||||
|
|
|
@ -356,6 +356,12 @@ function Player:getAttackRange()
|
||||||
local weapon = Fk:getCardById(self:getEquipment(Card.SubtypeWeapon))
|
local weapon = Fk:getCardById(self:getEquipment(Card.SubtypeWeapon))
|
||||||
local baseAttackRange = math.max(weapon and weapon.attack_range or 1, 0)
|
local baseAttackRange = math.max(weapon and weapon.attack_range or 1, 0)
|
||||||
|
|
||||||
|
local status_skills = Fk:currentRoom().status_skills[AttackRangeSkill] or {}
|
||||||
|
for _, skill in ipairs(status_skills) do
|
||||||
|
local correct = skill:getCorrect(self, other)
|
||||||
|
baseAttackRange = baseAttackRange + correct
|
||||||
|
end
|
||||||
|
|
||||||
return math.max(baseAttackRange, 0)
|
return math.max(baseAttackRange, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -410,11 +416,6 @@ function Player:inMyAttackRange(other)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
local baseAttackRange = self:getAttackRange()
|
local baseAttackRange = self:getAttackRange()
|
||||||
local status_skills = Fk:currentRoom().status_skills[AttackRangeSkill] or {}
|
|
||||||
for _, skill in ipairs(status_skills) do
|
|
||||||
local correct = skill:getCorrect(self, other)
|
|
||||||
baseAttackRange = baseAttackRange + correct
|
|
||||||
end
|
|
||||||
return self:distanceTo(other) <= baseAttackRange
|
return self:distanceTo(other) <= baseAttackRange
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ function ActiveSkill:getMaxCardNum()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ActiveSkill:getDistanceLimit(player, card)
|
function ActiveSkill:getDistanceLimit(player, card)
|
||||||
local ret = self.distance_limit
|
local ret = self.distance_limit or 0
|
||||||
local status_skills = Fk:currentRoom().status_skills[TargetModSkill] or {}
|
local status_skills = Fk:currentRoom().status_skills[TargetModSkill] or {}
|
||||||
for _, skill in ipairs(status_skills) do
|
for _, skill in ipairs(status_skills) do
|
||||||
local correct = skill:getDistanceLimit(player, self, card)
|
local correct = skill:getDistanceLimit(player, self, card)
|
||||||
|
|
|
@ -898,7 +898,7 @@ function Room:askForDiscard(player, minNum, maxNum, includeEquip, skillName, can
|
||||||
minNum = math.min(#canDiscards, minNum)
|
minNum = math.min(#canDiscards, minNum)
|
||||||
|
|
||||||
if minNum < 1 then
|
if minNum < 1 then
|
||||||
return nil
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local toDiscard = {}
|
local toDiscard = {}
|
||||||
|
|
|
@ -13,7 +13,10 @@ local slashSkill = fk.CreateActiveSkill{
|
||||||
target_filter = function(self, to_select, selected, _, card)
|
target_filter = function(self, to_select, selected, _, card)
|
||||||
if #selected < self:getMaxTargetNum(Self, card) then
|
if #selected < self:getMaxTargetNum(Self, card) then
|
||||||
local player = Fk:currentRoom():getPlayerById(to_select)
|
local player = Fk:currentRoom():getPlayerById(to_select)
|
||||||
return Self ~= player and Self:inMyAttackRange(player)
|
return Self ~= player and
|
||||||
|
(self:getDistanceLimit(Self, card) -- for no distance limit for slash
|
||||||
|
+ Self:getAttackRange()
|
||||||
|
>= Self:distanceTo(player))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_effect = function(self, room, effect)
|
on_effect = function(self, room, effect)
|
||||||
|
|
|
@ -121,6 +121,7 @@ callbacks["Chat"] = function(jsonData) {
|
||||||
let general = Backend.translate(data.general);
|
let general = Backend.translate(data.general);
|
||||||
let time = data.time;
|
let time = data.time;
|
||||||
let msg = data.msg;
|
let msg = data.msg;
|
||||||
|
|
||||||
if (general === "")
|
if (general === "")
|
||||||
current.addToChat(pid, data, `[${time}] ${userName}: ${msg}`);
|
current.addToChat(pid, data, `[${time}] ${userName}: ${msg}`);
|
||||||
else
|
else
|
||||||
|
|
|
@ -57,6 +57,7 @@ Item {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: Backend.translate("Observe")
|
text: Backend.translate("Observe")
|
||||||
|
visible: false // FIXME
|
||||||
font.pixelSize: 24
|
font.pixelSize: 24
|
||||||
TapHandler {
|
TapHandler {
|
||||||
onTapped: {
|
onTapped: {
|
||||||
|
|
|
@ -673,6 +673,10 @@ Item {
|
||||||
|
|
||||||
function addToChat(pid, raw, msg) {
|
function addToChat(pid, raw, msg) {
|
||||||
if (raw.type === 1) return;
|
if (raw.type === 1) return;
|
||||||
|
|
||||||
|
if (raw.msg.startsWith("$")) {
|
||||||
|
if (specialChat(pid, data, raw.msg.slice(1))) return;
|
||||||
|
}
|
||||||
chat.append(msg);
|
chat.append(msg);
|
||||||
let photo = Logic.getPhotoOrSelf(pid);
|
let photo = Logic.getPhotoOrSelf(pid);
|
||||||
if (photo === undefined)
|
if (photo === undefined)
|
||||||
|
@ -680,6 +684,73 @@ Item {
|
||||||
photo.chat(raw.msg);
|
photo.chat(raw.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function specialChat(pid, data, msg) {
|
||||||
|
// skill audio: %s%d
|
||||||
|
// death audio: ~%s
|
||||||
|
// something special: .%s:...
|
||||||
|
|
||||||
|
let time = data.time;
|
||||||
|
let userName = data.userName;
|
||||||
|
let general = Backend.translate(data.general);
|
||||||
|
|
||||||
|
if (msg.startsWith(".")) {
|
||||||
|
let splited = msg.split(":");
|
||||||
|
let type = splited[0].slice(1);
|
||||||
|
switch (type) {
|
||||||
|
case "egg": {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case "flower": {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (msg.startsWith("~")) {
|
||||||
|
let g = msg.slice(1);
|
||||||
|
let extension = JSON.parse(Backend.callLuaFunction("GetGeneralData", [g])).extension;
|
||||||
|
Backend.playSound("./packages/" + extension + "/audio/death/" + g);
|
||||||
|
|
||||||
|
let m = Backend.translate("~" + g);
|
||||||
|
if (general === "")
|
||||||
|
chat.append(`[${time}] ${userName}: ${m}`);
|
||||||
|
else
|
||||||
|
chat.append(`[${time}] ${userName}(${general}): ${m}`);
|
||||||
|
|
||||||
|
let photo = Logic.getPhotoOrSelf(pid);
|
||||||
|
if (photo === undefined)
|
||||||
|
return true;
|
||||||
|
photo.chat(m);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
let splited = msg.split(":");
|
||||||
|
if (splited.length < 2) return false;
|
||||||
|
let skill = splited[0];
|
||||||
|
let idx = parseInt(splited[1]);
|
||||||
|
|
||||||
|
let data2 = JSON.parse(Backend.callLuaFunction("GetSkillData", [skill]));
|
||||||
|
if (!data2) return false;
|
||||||
|
let extension = data2.extension;
|
||||||
|
Backend.playSound("./packages/" + extension + "/audio/skill/" + skill, idx);
|
||||||
|
|
||||||
|
let m = Backend.translate("$" + skill + idx.toString());
|
||||||
|
if (general === "")
|
||||||
|
chat.append(`[${time}] ${userName}: ${m}`);
|
||||||
|
else
|
||||||
|
chat.append(`[${time}] ${userName}(${general}): ${m}`);
|
||||||
|
|
||||||
|
let photo = Logic.getPhotoOrSelf(pid);
|
||||||
|
if (photo === undefined)
|
||||||
|
return true;
|
||||||
|
photo.chat(m);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function addToLog(msg) {
|
function addToLog(msg) {
|
||||||
log.append(msg);
|
log.append(msg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue