|
68 | 68 | ]; |
69 | 69 | const count=pick([2,3,3,3,3,4,4,4,4,5,6]); |
70 | 70 | const actions=[]; |
| 71 | + let hasCommand=false; // an 'event' family action emits a semantic 'command' signal |
71 | 72 | const condition=()=>pick([{type:'hpPctBelow',value:.5},{type:'targetHpPctBelow',value:.4},{type:'resourceAtLeast',resource,value:3},{type:'targetHasStatus',status:dotId},{type:'missingStatus',status:buffId}]); |
72 | 73 | for(let i=0;i<count;i++){ |
73 | 74 | const weighted=FAMILIES.concat(ROLES[archetype],ROLES[archetype]); |
|
89 | 90 | case 'resource':a.effects=[{type:pick(['gain','resource']),resource,amount:2+r.random(3)}];break; |
90 | 91 | case 'convert':a.effects=[{type:'convertResource',from:'ENERGY',to:resource,amount:2,ratio:2}];break; |
91 | 92 | case 'cooldown':a.target='ally';a.effects=[{type:'cooldownReduce',amount:1+r.random(2)}];break; |
92 | | - case 'event':a.effects=[{type:'emitEvent',event:'afterKill',eventSubject:'actor'}];break; |
| 93 | + case 'event':hasCommand=true;a.effects=[{type:'emitEvent',event:'command',eventSubject:'actor'}];break; |
93 | 94 | case 'toggle':a.kind='status';a.effects=[{type:'toggleStatus',status:buffId,duration}];break; |
94 | 95 | } |
95 | 96 | // Independently compose secondary effects, control flow, target queries and costs. |
|
109 | 110 | actions.push(a); |
110 | 111 | } |
111 | 112 | const triggers=[{event:pick(['roundStart','roundEnd','afterDamageTaken','afterDamageDealt','afterKill']),target:'self',effects:[{type:pick(['heal','shield']),formula:'MAX_HP * '+round(.025*scale)}]}, |
112 | | - {event:'afterKill',target:'self',effects:[{type:'gain',resource,amount:3}]}]; |
| 113 | + {event:'afterKill',target:'self',effects:[{type:'gain',resource,amount:3}]}, |
| 114 | + ...(hasCommand?[{event:'command',target:'self',effects:[{type:'gain',resource,amount:2}]}]:[])]; |
113 | 115 | const name=N.generateDisplayName({seed,rarity,level,archetype}); |
114 | 116 | const card={id,identity,seed,generatorVersion:3,rarity,level,archetype,name,displayName:name,generationBudget,quality:N.qualityFactor(seed),stats,actions,statuses,triggers,resourceRegens, |
115 | 117 | resources:{ENERGY:{max:8,regen:2},[resource]:{max:8,regen:1}},resistances:{[type]:round(.15*scale)},affinities:{[type]:round(.12*scale)}, |
|
0 commit comments