标准包武将添加技能代码提示
This commit is contained in:
parent
9bbb4d7d84
commit
997a5f070e
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'standard',
|
||||
|
@ -93,6 +93,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
ganning:['lingtong','xf_sufei'],
|
||||
guanyu:['zhangfei','liaohua'],
|
||||
},
|
||||
/**
|
||||
* @type { { [key: string]: Skill } }
|
||||
*/
|
||||
skill:{
|
||||
//标准版甘夫人
|
||||
stdshushen:{
|
||||
|
@ -304,7 +307,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
logTarget:'source',
|
||||
preHidden:true,
|
||||
filter(event,player){
|
||||
return (event.source&&event.source.countGainableCards(player,event.source!=player?'he':'e')&&event.num>0);
|
||||
return event.source&&event.source.countGainableCards(player,event.source!=player?'he':'e')>0&&event.num>0;
|
||||
},
|
||||
async content(event,trigger,player){
|
||||
player.gainPlayerCard(true,trigger.source,trigger.source!=player?'he':'e');
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
declare type CardBaseUIData = {
|
||||
name?: string;
|
||||
suit?: string;
|
||||
number?: number;
|
||||
nature?: string;
|
||||
|
||||
//用于某些方法,用于过滤卡牌的额外结构
|
||||
type?: string;
|
||||
subtype?: string;
|
||||
color?: string;
|
||||
|
||||
/**
|
||||
* 是否时视为牌
|
||||
*
|
||||
* 是本来的卡牌,则为true,作为视为牌则为false/undefined
|
||||
* 在useCard使用时,作为视为牌,会把next.cards,设置为card.cards;
|
||||
*
|
||||
*/
|
||||
isCard?: boolean;
|
||||
|
||||
/** 真实使用的卡牌 */
|
||||
cards?: Card[];
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
declare interface Result {
|
||||
/**
|
||||
* 最终结果
|
||||
*
|
||||
* 大多代表该事件到达这一步骤过程中的结果;
|
||||
* 一般用来标记当前事件是否按预定执行的,即执行成功
|
||||
*
|
||||
* 大部分事件间接接触game.check,一般最终结果不变,大多数是这种
|
||||
*
|
||||
* 其实主要是ok方法会有直接的bool,主要涉及game.check;
|
||||
*/
|
||||
bool?: boolean;
|
||||
|
||||
//choose系
|
||||
/** 记录返回当前事件操作过程中的卡牌 */
|
||||
cards: Card[];
|
||||
/** 记录返回当前事件操作过程中的目标 */
|
||||
targets: Player[];
|
||||
/** 记录返回当前事件操作过程中的按钮 */
|
||||
buttons: Button[];
|
||||
/** 记录buttons内所有button.link(即该按钮的类型,link的类型很多,参考按钮的item) */
|
||||
links: any[];
|
||||
|
||||
//control系(直接control系列没有result.bool)
|
||||
/** control操作面板的选中结果,即该按钮的link,即名字 */
|
||||
control: string;
|
||||
/** 既control的下标 */
|
||||
index: number;
|
||||
|
||||
//ok系
|
||||
/** 记录返回当前事件操作过程中,面板按钮的确定ok取消cancel */
|
||||
confirm: string;
|
||||
/** 一般为触发的“视为”技能 */
|
||||
skill: string;
|
||||
/**
|
||||
* 当前事件操作的“视为”牌,
|
||||
* 当前有“视为”操作,该card参数特供给视为牌,不需要cards[0]获取视为牌 ;
|
||||
* 判断是否为视为牌:card.isCard,false为视为牌
|
||||
*/
|
||||
card: Card;
|
||||
|
||||
[key: string]: any;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,11 @@
|
|||
/// <reference path="./ArrayEx.d.ts" />
|
||||
/// <reference path="./Card.d.ts" />
|
||||
/// <reference path="./DateEx.d.ts" />
|
||||
/// <reference path="./HTMLDivElementEx.d.ts" />
|
||||
/// <reference path="./HTMLTableELementEx.d.ts" />
|
||||
/// <reference path="./windowEx.d.ts" />
|
||||
/// <reference path="./Result.d.ts" />
|
||||
/// <reference path="./Skill.d.ts" />
|
||||
/// <reference path="./type.d.ts" />
|
||||
/// <reference path="./MapEx.d.ts" />
|
||||
/// <reference types="@types/cordova" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "noname-typings",
|
||||
"version": "2023.12.31",
|
||||
"version": "2024.01.16",
|
||||
"description": "Noname typings, mainly for showing type hints when creating extensions of the Sanguosha-like game Noname.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -17,15 +17,43 @@ interface NMap<V> {
|
|||
[key: number]: V
|
||||
}
|
||||
|
||||
declare type Game = import('../../noname/game/index.js').Game;
|
||||
declare type Library = import('../../noname/library/index.js').Library;
|
||||
//从0个参数到任意参数的方法结构声明
|
||||
type NoneParmFum<T> = () => T;
|
||||
type OneParmFun<U, T> = (arg0: U) => T;
|
||||
type TwoParmFun<U1, U2, T> = (arg0: U1, arg1: U2) => T;
|
||||
type ThreeParmFun<U1, U2, U3, T> = (arg0: U1, arg1: U2, arg2: U3) => T;
|
||||
type FourParmFun<U1, U2, U3, U4, T> = (arg0: U1, arg1: U2, arg2: U3, arg3: U4) => T;
|
||||
type RestParmFun<T> = (...args) => T;
|
||||
type RestParmFun2<U, T> = (...args: U[]) => T;
|
||||
|
||||
//尝试增加的符合类型声明
|
||||
/** SingleAndArrayType:单体与集合类型 */
|
||||
type SAAType<T> = T | T[];
|
||||
/** 再价格可以返回这种类型的方法 */
|
||||
type SAAFType<T> = T | T[] | RestParmFun<T>;
|
||||
/** 有name属性的对象 */
|
||||
type NameType = { name: string };
|
||||
/** 技能或者卡牌 */
|
||||
type SkillOrCard = string | NameType | Card;
|
||||
/** 卡牌或者卡牌集合 */
|
||||
type CCards = SAAType<Card>;
|
||||
|
||||
/** 技能content */
|
||||
declare type ContentFuncByAll = {
|
||||
// (event: GameEventPromise, step: number, source: Player, player: Player, target: Player, targets: Player[], card: Card, cards: Card[], skill: string, forced: boolean, num: number, trigger: GameEventPromise, result: Result): any,
|
||||
(event: GameEventPromise, trigger: GameEventPromise, player: Player): Promise<any>;
|
||||
}
|
||||
|
||||
declare type Game = typeof import('../../noname/game/index.js').Game;
|
||||
declare type Library = typeof import('../../noname/library/index.js').Library;
|
||||
declare type Status = typeof import('../../noname/status/index.js').status;
|
||||
declare type UI = import('../../noname/ui/index.js').UI;
|
||||
declare type Get = import('../../noname/get/index.js').Get;
|
||||
declare type AI = import('../../noname/ai/index.js').AI;
|
||||
declare type UI = typeof import('../../noname/ui/index.js').UI;
|
||||
declare type Get = typeof import('../../noname/get/index.js').Get;
|
||||
declare type AI = typeof import('../../noname/ai/index.js').AI;
|
||||
|
||||
declare type Button = import('../../noname/library/index.js').Button;
|
||||
declare type Card = import('../../noname/library/index.js').Card;
|
||||
declare type VCard = import('../../noname/library/index.js').VCard;
|
||||
declare type Dialog = import('../../noname/library/index.js').Dialog;
|
||||
declare type GameEvent = import('../../noname/library/index.js').GameEvent;
|
||||
declare type GameEventPromise = import('../../noname/library/index.js').GameEventPromise;
|
||||
|
@ -39,4 +67,5 @@ declare type GameHistory = import('../../noname/game/index.js').GameHistory;
|
|||
declare type CodeMirror = typeof import('../../game/codemirror.js').default;
|
||||
|
||||
declare type Sex = 'male' | 'female' | 'dobule' | 'none';
|
||||
declare type Character = [Sex, string, number | string, string[], string[]];
|
||||
declare type Character = [Sex, string, number | string, string[], string[]];
|
||||
declare type Select = [number, number];
|
|
@ -1961,8 +1961,8 @@ export class Get extends Uninstantable {
|
|||
}
|
||||
}
|
||||
/**
|
||||
* @param { number | [number, number] | (()=>[number, number]) } [select]
|
||||
* @returns { [number, number] }
|
||||
* @param { number | Select | (()=>Select) } [select]
|
||||
* @returns { Select }
|
||||
*/
|
||||
static select(select) {
|
||||
if (typeof select == 'function') return get.select(select());
|
||||
|
|
|
@ -332,7 +332,7 @@ export class Is extends Uninstantable {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
static altered() { return false; }
|
||||
static altered(skillName) { return false; }
|
||||
/*
|
||||
skill=>{
|
||||
return false;
|
||||
|
|
|
@ -45,6 +45,10 @@ export class GameEvent {
|
|||
};
|
||||
this._aiexclude = [];
|
||||
this._notrigger = [];
|
||||
/**
|
||||
* @type { Result }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this._result = {};
|
||||
this._set = [];
|
||||
/**
|
||||
|
@ -862,6 +866,11 @@ export class GameEvent {
|
|||
*/
|
||||
// @ts-ignore
|
||||
this.excludeButton;
|
||||
/**
|
||||
* @type { Result }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.result;
|
||||
throw new Error('Do not call this method');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import { AsyncFunction } from '../../util/index.js';
|
|||
* 且Promise的原有属性无法被修改,一切对这个类实例的属性修改,删除,
|
||||
* 再配置等操作都会转发到事件对应的属性中。
|
||||
*
|
||||
* @todo 需要完成异步事件的debugger方法
|
||||
* @template { GameEvent } T
|
||||
*
|
||||
* @example
|
||||
* 使用await xx()等待异步事件执行:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* @typedef { InstanceType<typeof lib.element.Button> } Button
|
||||
* @typedef { InstanceType<typeof lib.element.Dialog> } Dialog
|
||||
* @typedef { InstanceType<typeof lib.element.GameEvent> } GameEvent
|
||||
* @typedef { InstanceType<typeof lib.element.GameEvent> & InstanceType<typeof lib.element.GameEventPromise> & typeof Promise<typeof lib.element.GameEvent> } GameEventPromise
|
||||
* @typedef { InstanceType<typeof lib.element.GameEvent> & InstanceType<typeof lib.element.GameEventPromise & typeof Promise<InstanceType<typeof lib.element.GameEvent>> } GameEventPromise
|
||||
* @typedef { InstanceType<typeof lib.element.NodeWS> } NodeWS
|
||||
* @typedef { InstanceType<typeof lib.element.Control> } Control
|
||||
*/
|
||||
|
@ -10198,6 +10198,19 @@ export class Library extends Uninstantable {
|
|||
return 0;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @type {{
|
||||
* global: string[];
|
||||
* globalmap: SMap<Player[]>;
|
||||
* storage: SMap<any>;
|
||||
* undist: SMap<any>;
|
||||
* thers: SMap<any>;
|
||||
* zhu: SMap<any>;
|
||||
* zhuSkill: SMap<any>;
|
||||
* land_used: SMap<any>;
|
||||
* [key: string]: Skill;
|
||||
* }}
|
||||
*/
|
||||
static skill = {
|
||||
stratagem_fury: {
|
||||
marktext: '🔥',
|
||||
|
|
|
@ -14134,6 +14134,14 @@ export class UI extends Uninstantable {
|
|||
* @type { Control | undefined }
|
||||
*/
|
||||
static skills3;
|
||||
/**
|
||||
* @type { HTMLDivElement }
|
||||
*/
|
||||
static window;
|
||||
/**
|
||||
* @type { HTMLDivElement }
|
||||
*/
|
||||
static pause;
|
||||
static refresh(node) {
|
||||
void window.getComputedStyle(node, null).getPropertyValue("opacity");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue