Permalink
Browse files

retrieve ai for old YJCM generals

  • Loading branch information...
1 parent 527c32d commit 4783fbfa4a3b9fab057b0d8553799296ff705372 @clarkcyt clarkcyt committed Apr 30, 2012
@@ -21,7 +21,7 @@ return {
[":qiangxi"] = "出牌阶段,你可以失去1点体力或弃置一张武器牌,并对你攻击范围内的一名角色造成1点伤害。每阶段限一次",
["#wolong"] = "卧龙",
- ["wolong"] = "诸葛亮",
+ ["wolong"] = "小诸葛",
["bazhen"] = "八阵",
[":bazhen"] = "<b>锁定技</b>,若你的装备区没有防具牌,视为你装备着【八卦阵】\
★装备任何防具都会失去“八阵”的效果",
View
@@ -95,10 +95,10 @@ return {
["Hulaopass"] = "虎牢关模式",
["#shenlvbu1"] = "最强神话",
- ["shenlvbu1"] = "神吕布(1)",
+ ["shenlvbu1"] = "虎牢关吕布",
["illustrator:shenlvbu1"] = "LiuHeng",
["#shenlvbu2"] = "暴怒的战神",
- ["shenlvbu2"] = "神吕布(2)",
+ ["shenlvbu2"] = "虎牢关吕布",
["illustrator:shenlvbu2"] = "LiuHeng",
["xiuluo"] = "修罗",
[":xiuluo"] = "回合开始阶段,你可以弃置一张手牌来将你判定区里的一张延时类锦囊置入弃牌堆(必须花色相同)。",
View
@@ -264,28 +264,28 @@ function SmartAI:useCardIronChain(card, use)
table.insert(enemytargets, enemy)
end
end
-
- if #friendtargets > 1 then
- if use.to then use.to:append(friendtargets[1]) end
- if use.to then use.to:append(friendtargets[2]) end
- elseif #friendtargets == 1 then
- if #enemytargets > 0 then
- if use.to then use.to:append(friendtargets[1]) end
- if use.to then use.to:append(enemytargets[1]) end
- elseif yangxiu and self:isFriend(yangxiu) then
+ if not self.player:hasSkill("nos_wuyan") then
+ if #friendtargets > 1 then
if use.to then use.to:append(friendtargets[1]) end
- if use.to then use.to:append(yangxiu) end
- end
- elseif #enemytargets > 1 then
- if use.to then use.to:append(enemytargets[1]) end
- if use.to then use.to:append(enemytargets[2]) end
- elseif #friendtargets == 1 then
- if yangxiu and self:isFriend(yangxiu) then
+ if use.to then use.to:append(friendtargets[2]) end
+ elseif #friendtargets == 1 then
+ if #enemytargets > 0 then
+ if use.to then use.to:append(friendtargets[1]) end
+ if use.to then use.to:append(enemytargets[1]) end
+ elseif yangxiu and self:isFriend(yangxiu) then
+ if use.to then use.to:append(friendtargets[1]) end
+ if use.to then use.to:append(yangxiu) end
+ end
+ elseif #enemytargets > 1 then
if use.to then use.to:append(enemytargets[1]) end
- if use.to then use.to:append(yangxiu) end
+ if use.to then use.to:append(enemytargets[2]) end
+ elseif #friendtargets == 1 then
+ if yangxiu and self:isFriend(yangxiu) then
+ if use.to then use.to:append(enemytargets[1]) end
+ if use.to then use.to:append(yangxiu) end
+ end
end
end
-
if use.to then assert(use.to:length() < 3) end
end
View
@@ -1,2 +1,196 @@
sgs.weapon_range.MoonSpear = 3
-sgs.ai_use_priority.MoonSpear = 2.635
+sgs.ai_use_priority.MoonSpear = 2.635
+
+nos_jujian_skill={}
+nos_jujian_skill.name="nos_jujian"
+table.insert(sgs.ai_skills,nos_jujian_skill)
+nos_jujian_skill.getTurnUseCard=function(self)
+ if not self.player:hasUsed("NosJujianCard") then return sgs.Card_Parse("@NosJujianCard=.") end
+end
+
+sgs.ai_skill_use_func.NosJujianCard = function(card, use, self)
+ local abandon_handcard = {}
+ local index = 0
+ local hasPeach = (self:getCardsNum("Peach") > 0)
+
+ local trick_num, basic_num, equip_num = 0, 0, 0
+ if not hasPeach and self.player:isWounded() and self.player:getHandcardNum() >=3 then
+ local cards = self.player:getHandcards()
+ cards=sgs.QList2Table(cards)
+ self:sortByUseValue(cards, true)
+ for _, card in ipairs(cards) do
+ if card:getTypeId() == sgs.Card_Trick and not card:inherits("ExNihilo") then trick_num = trick_num + 1
+ elseif card:getTypeId() == sgs.Card_Basic then basic_num = basic_num + 1
+ elseif card:getTypeId() == sgs.Card_Equip then equip_num = equip_num + 1
+ end
+ end
+ local result_class
+ if trick_num >= 3 then result_class = "TrickCard"
+ elseif equip_num >= 3 then result_class = "EquipCard"
+ elseif basic_num >= 3 then result_class = "BasicCard"
+ end
+ local f
+ for _, friend in ipairs(self.friends_noself) do
+ if (friend:getHandcardNum()<2) or (friend:getHandcardNum()<friend:getHp()+1) and not friend:hasSkill("manjuan") then
+ for _, fcard in ipairs(cards) do
+ if fcard:inherits(result_class) and not fcard:inherits("ExNihilo") then
+ table.insert(abandon_handcard, fcard:getId())
+ index = index + 1
+ end
+ if index == 3 then f = friend break end
+ end
+ end
+ end
+ if index == 3 then
+ if use.to then use.to:append(f) end
+ use.card = sgs.Card_Parse("@NosJujianCard=" .. table.concat(abandon_handcard, "+"))
+ return
+ end
+ end
+ abandon_handcard = {}
+ local cards = self.player:getHandcards()
+ cards=sgs.QList2Table(cards)
+ self:sortByUseValue(cards, true)
+ local slash_num = self:getCardsNum("Slash")
+ local jink_num = self:getCardsNum("Jink")
+ for _, friend in ipairs(self.friends_noself) do
+ if (friend:getHandcardNum()<2) or (friend:getHandcardNum()<friend:getHp()+1) or self.player:isWounded() then
+ for _, card in ipairs(cards) do
+ if #abandon_handcard >= 3 then break end
+ if not card:inherits("Nullification") and not card:inherits("EquipCard") and
+ not card:inherits("Peach") and not card:inherits("Jink") and
+ not card:inherits("Indulgence") and not card:inherits("SupplyShortage") then
+ table.insert(abandon_handcard, card:getId())
+ index = 5
+ elseif card:inherits("Slash") and slash_num > 1 then
+ if (self.player:getWeapon() and not self.player:getWeapon():objectName()=="crossbow") or
+ not self.player:getWeapon() then
+ table.insert(abandon_handcard, card:getId())
+ index = 5
+ slash_num = slash_num - 1
+ end
+ elseif card:inherits("Jink") and jink_num > 1 then
+ table.insert(abandon_handcard, card:getId())
+ index = 5
+ jink_num = jink_num - 1
+ end
+ end
+ if index == 5 then
+ use.card = sgs.Card_Parse("@NosJujianCard=" .. table.concat(abandon_handcard, "+"))
+ if use.to then use.to:append(friend) end
+ return
+ end
+ end
+ end
+ if #self.friends_noself>0 and self:getOverflow()>0 then
+ self:sort(self.friends_noself, "handcard")
+ local discard = self:askForDiscard("gamerule", math.min(self:getOverflow(),3))
+ use.card = sgs.Card_Parse("@NosJujianCard=" .. table.concat(discard, "+"))
+ if use.to then use.to:append(self.friends_noself[1]) end
+ return
+ end
+end
+
+sgs.ai_use_priority.NosJujianCard = 4.5
+sgs.ai_use_value.NosJujianCard = 6.7
+
+sgs.ai_card_intention.NosJujianCard = -100
+
+sgs.dynamic_value.benefit.NosJujianCard = true
+
+sgs.ai_skill_cardask["@enyuanheart"] = function(self)
+ local cards = self.player:getHandcards()
+ for _, card in sgs.qlist(cards) do
+ if card:getSuit() == sgs.Card_Heart and not (card:inherits("Peach") or card:inherits("ExNihilo")) then
+ return card:getEffectiveId()
+ end
+ end
+ return "."
+end
+
+function sgs.ai_slash_prohibit.nos_enyuan(self)
+ if self:isWeak() then return true end
+end
+
+nos_xuanhuo_skill={}
+nos_xuanhuo_skill.name="nos_xuanhuo"
+table.insert(sgs.ai_skills,nos_xuanhuo_skill)
+nos_xuanhuo_skill.getTurnUseCard=function(self)
+ if not self.player:hasUsed("NosXuanhuoCard") then
+ return sgs.Card_Parse("@NosXuanhuoCard=.")
+ end
+end
+
+sgs.ai_skill_use_func.NosXuanhuoCard = function(card, use, self)
+ local cards = self.player:getHandcards()
+ cards=sgs.QList2Table(cards)
+ self:sortByUseValue(cards,true)
+
+ local target
+ for _, friend in ipairs(self.friends_noself) do
+ if self:hasSkills(sgs.lose_equip_skill, friend) and not friend:getEquips():isEmpty() then
+ for _, card in ipairs(cards) do
+ if card:getSuit() == sgs.Card_Heart and self.player:getHandcardNum() > 1 then
+ use.card = sgs.Card_Parse("@NosXuanhuoCard=" .. card:getEffectiveId())
+ target = friend
+ break
+ end
+ end
+ end
+ if target then break end
+ end
+ if not target then
+ for _, enemy in ipairs(self.enemies) do
+ if not enemy:isKongcheng() then
+ for _, card in ipairs(cards)do
+ if card:getSuit() == sgs.Card_Heart and not card:inherits("Peach") and self.player:getHandcardNum() > 1 then
+ use.card = sgs.Card_Parse("@NosXuanhuoCard=" .. card:getEffectiveId())
+ target = enemy
+ break
+ end
+ end
+ end
+ if target then break end
+ end
+ end
+
+ if target then
+ self.room:setPlayerFlag(target, "xuanhuo_target")
+ if use.to then
+ use.to:append(target)
+ end
+ end
+end
+
+sgs.ai_skill_playerchosen.nos_xuanhuo = function(self, targets)
+ for _, player in sgs.qlist(targets) do
+ if (player:getHandcardNum() <= 2 or player:getHp() < 2) and self:isFriend(player)
+ and not player:hasFlag("xuanhuo_target") and not self:needKongcheng(player) and not player:hasSkill("manjuan") then
+ return player
+ end
+ end
+end
+
+sgs.nos_fazheng_suit_value =
+{
+ heart = 3.9
+}
+
+sgs.ai_chaofeng.nos_fazheng = -3
+
+sgs.ai_skill_choice.nos_xuanfeng = function(self, choices)
+ self:sort(self.enemies, "defense")
+ local slash = sgs.Card_Parse(("slash[%s:%s]"):format(sgs.Card_NoSuit, 0))
+ for _, enemy in ipairs(self.enemies) do
+ if self.player:distanceTo(enemy)<=1 then
+ return "damage"
+ elseif not self:slashProhibit(slash ,enemy) then
+ return "slash"
+ end
+ end
+ return "nothing"
+end
+
+sgs.ai_skill_playerchosen.nos_xuanfeng_damage = sgs.ai_skill_playerchosen.damage
+
+sgs.ai_skill_playerchosen.nos_xuanfeng_slash = sgs.ai_skill_playerchosen.zero_card_as_slash
View
@@ -70,7 +70,7 @@ function setInitialTables()
sgs.target = {loyalist = nil, rebel = nil, renegade = nil } -- obsolete
sgs.discard_pile = global_room:getDiscardPile()
sgs.draw_pile = global_room:getDrawPile()
- sgs.lose_equip_skill = "xiaoji|xuanfeng"
+ sgs.lose_equip_skill = "xiaoji|xuanfeng|nos_xuanfeng"
sgs.need_kongcheng = "lianying|kongcheng"
sgs.masochism_skill = "fankui|jieming|yiji|ganglie|enyuan|fangzhu|guixin"
sgs.wizard_skill = "guicai|guidao|jilve|tiandu"
@@ -324,6 +324,14 @@ function SmartAI:getUsePriority(card)
end
if v then return v else return sgs.ai_use_priority[class_name] end
end
+ if self.player:hasSkill("nos_wuyan") then
+ if card:inherits("Slash") then
+ v = 4
+
+ elseif card:inherits("Collateral") or card:inherits("Dismantlement") or card:inherits("Snatch") or card:inherits("IronChain") then v = 0
+ end
+ if v then return v else return sgs.ai_use_priority[class_name] end
+ end
if self.player:hasSkill("qingnang") then
if card:inherits("Dismantlement") then v = 3.8
elseif card:inherits("Collateral") then v = 3.9
@@ -3263,6 +3271,10 @@ function SmartAI:aoeIsEffective(card, to)
return false
end
+ if self.player:hasSkill("nos_wuyan") then
+ return false
+ end
+
if card:inherits("SavageAssault") then
if to:hasSkill("huoshou") or to:hasSkill("juxiang") then
return false
@@ -3454,7 +3466,7 @@ end
function SmartAI:hasTrickEffective(card, player)
if player then
if self.room:isProhibited(self.player, player, card) then return false end
- if (player:hasSkill("zhichi") and self.room:getTag("Zhichi"):toString() == player:objectName()) then
+ if (player:hasSkill("zhichi") and self.room:getTag("Zhichi"):toString() == player:objectName()) or player:hasSkill("nos_wuyan") then
if card and not (card:inherits("Indulgence") or card:inherits("SupplyShortage")) then return false end
end
if player:hasSkill("wuyan") then
@@ -3469,6 +3481,11 @@ function SmartAI:hasTrickEffective(card, player)
(card:inherits("Duel") or card:inherits("FireAttack") or card:inherits("ArcheryAttack") or card:inherits("SavageAssault")) then
return false end
end
+ if self.player:hasSkill("nos_wuyan") then
+ if card:inherits("TrickCard") and not
+ (card:inherits("DelayedTrick") or card:inherits("GodSalvation") or card:inherits("AmazingGrace")) then
+ return false end
+ end
end
return true
end
@@ -678,6 +678,8 @@ function SmartAI:useCardAmazingGrace(card, use)
if #self.friends >= #self.enemies or (self:hasSkills(sgs.need_kongcheng) and self.player:getHandcardNum() == 1)
or self.player:hasSkill("jizhi") then
use.card = card
+ elseif self.player:hasSkill("nos_wuyan") then
+ use.card = card
end
end
@@ -687,6 +689,10 @@ sgs.ai_use_priority.AmazingGrace = 1
function SmartAI:useCardGodSalvation(card, use)
local good, bad = 0, 0
+ if self.player:hasSkill("nos_wuyan") and self.player:isWounded() then
+ use.card = card
+ return
+ end
for _, friend in ipairs(self.friends) do
if friend:isWounded() then
@@ -852,21 +858,21 @@ function SmartAI:getValuableCard(who)
self:sort(self.friends, "hp")
local friend
if #self.friends > 0 then friend = self.friends[1] end
- if friend and self:isWeak(friend) and who:inMyAttackRange(friend) and not who:hasSkill("xuanfeng") then
+ if friend and self:isWeak(friend) and who:inMyAttackRange(friend) and not who:hasSkill("nos_xuanfeng") then
if weapon and who:distanceTo(friend) > 1 and not
(weapon and weapon:inherits("MoonSpear") and who:hasSkill("keji") and who:getHandcardNum() > 5) then return weapon:getEffectiveId() end
if offhorse and who:distanceTo(friend) > 1 then return offhorse:getEffectiveId() end
end
- if defhorse and not who:hasSkill("xuanfeng") then
+ if defhorse and not who:hasSkill("nos_xuanfeng") then
for _,friend in ipairs(self.friends) do
if friend:distanceTo(who) == friend:getAttackRange()+1 then
return defhorse:getEffectiveId()
end
end
end
- if armor and self:evaluateArmor(armor,who)>3 and not who:hasSkill("xuanfeng") then
+ if armor and self:evaluateArmor(armor,who)>3 and not who:hasSkill("nos_xuanfeng") then
return armor:getEffectiveId()
end
@@ -917,6 +923,7 @@ end
function SmartAI:useCardSnatchOrDismantlement(card, use)
local name = card:objectName()
+ if self.player:hasSkill("nos_wuyan") then return end
local players = self.room:getOtherPlayers(self.player)
local tricks
players = self:exclude(players, card)
@@ -1077,6 +1084,7 @@ end
sgs.dynamic_value.control_card.Dismantlement = true
function SmartAI:useCardCollateral(card, use)
+ if self.player:hasSkill("nos_wuyan") then return end
self:sort(self.enemies,"threat")
for _, friend in ipairs(self.friends_noself) do
View
@@ -62,8 +62,8 @@ void Settings::init(){
if(!contains("BanPackages")){
QStringList banlist;
- banlist << "nostalgia" << "yitian" << "wisdom" << "test"
- << "disaster" << "god" << "YJCM" << "yitian_cards"
+ banlist << "nostalgia" << "nostal_general" << "yitian" << "wisdom"
+ << "disaster" << "god" << "YJCM" << "yitian_cards" << "test"
<< "sp" << "sp_cards" << "BGM" << "YJCM2012" << "Special3v3"
<< "joy" << "joy_equip" ;

0 comments on commit 4783fbf

Please sign in to comment.