-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
“获得/失去技能时”的时机 #950
Merged
Merged
“获得/失去技能时”的时机 #950
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
不会有获得单个技能的时机?
会创建另一个事件吗? 个人认为 player.changeSkill()
.add([/* */])
.removeAdditional('junkyuheng', [])
.remove([/* */]); 这样的API是不是更易用,也同时解决了处理顺序的问题 |
时机默认是多个技能的(减少插入结算)。你要是单个加也没人拦你。 |
Spmario233
added a commit
that referenced
this pull request
Feb 17, 2024
v1.10.8版本更新内容 ※我们继续和一些优秀且具有开源精神的代码编写者保持着积极合作。在这一版本中,我们通过接收GitHub的Pull Request,整合了@mengxinzxz @Rintim @universe-st @nonameShijian @kuangshen04 @copcap @lieren2023 @7754496 等8位代码贡献者编写的代码。 ※添加OL武将「神张角(OL削弱版)」;调整「神许褚」「霍峻」「庞山明」「刘理」「星袁绍」「张薇」「柏灵筠」的技能。 ※针对三国杀官方武将和扩展武将的编写需求,添加了“获得/失去技能”的时机,以及变更武将牌的函数。具体请参考:#950 ※移除一个导致14.5版本的Safari内核浏览器无法正常运行的新特性,从而修复部分iOS系统无法运行的bug。 ※现在卡牌的图片和语音可以根据卡牌的花色/点数/属性等要素动态生成了。 ※现在game.expandSkills不会展开lib.skill中不存在的子技能,从而避免部分扩展作者引用不存在的子技能导致游戏运行出错。 ※现在本体会捕捉扩展的precontent和content运行过程中出现的bug,并进行弹窗提示了(可关闭该弹窗)。 ※对noname/ui/index.js进行拆分。 ※其他bug修复和机制优化和AI调整。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
将GameEvent#trigger的返回值改为新触发的arrangeTrigger事件,从而可以在async content里面进行等待。
此外,添加事件化版本的”技能变化“事件,从而实现“获得技能时”和”失去技能时“的时机。
添加函数
Player#changeSkills([要获得的技能], [要失去的技能])
,用于进行技能的获得和移除。使用例:changeSkills事件拥有四个标准的时机(changeSkillsBefore/changeSkillsBegin/changeSkillsEnd/changeSkillsAfter),且在触发时机前会自动去重。在该GameEvent中,
event.addSkill
为本次事件中,角色获得的技能;event.removeSkill
为本次事件中,角色失去的技能。默认为先获得技能,后失去技能。如果你只需要获得技能/只需要失去技能,那么可以直接使用
Player#addSkills
和Player#removeSkills
。使用例:这两个函数会直接调用changeSkills事件。
注意!!! 如果你只是想获得一个“效果”(比如天义拼点成功之后多刀的效果),而不是像觉醒技一样获得一个“技能”,请继续使用addSkill/removeSkill,而不是使用新的函数!
Player#addTempSkills
、Player#addAdditionalSkills
和Player#removeAdditionalSkills
也已经封装完毕,作为它们对应的原函数的事件版本,参数与原本的函数基本相同。如果有特殊的需求(比如自定义game.log的内容,或者自行决定失去/获得技能的先后顺序),可以给changeSkills事件触发自定义的
$handle流程
。具体请参考addTempSkills和addAdditionalSkills的底层实现。此外,还添加了
Player#changeCharacter
的函数,触发一个变更武将牌的事件,并在事件内部触发“变更势力”和“变更技能”的事件。但该事件不会变更角色的体力值和体力上限,请自行手动判断和手动变更。使用例:无论角色原本有没有副将,或者原本的副将是否为目标角色,该函数都可以自行判断并处理。如果你想和reinit函数一样,写成旧武将→新武将的一对一替换,那么可以使用
Player#reinitCharacter
,该函数会自动生成对应的changeCharacter事件。使用例: