Add console debug for cardEffect

develop
Nathan Steel 1 year ago
parent 876b705407
commit f9919bde0e

@ -1285,6 +1285,7 @@ canvas.addEventListener('contextmenu', function(event) {
console.log('itemId: '+itemKey); console.log('itemId: '+itemKey);
document.getElementById('effectTargetId').value = itemKey; document.getElementById('effectTargetId').value = itemKey;
document.getElementById('triggerTargetId').value = itemKey; document.getElementById('triggerTargetId').value = itemKey;
debugGetCardEffects(itemKey);
// Only want to happen once (for now) // Only want to happen once (for now)
// Maybe in future add to hand would trigger another event if there's an effect? // Maybe in future add to hand would trigger another event if there's an effect?

@ -91,3 +91,63 @@ function debugTriggerFunction(targetId = null, trigger = null, triggerAmount = n
} }
} }
// Builds console log for card effect (inc.
// all triggers, etc)
function debugGetCardEffects(itemKey){
let effectData = cardEffect[itemKey];
console.log(effectData);
if(effectData === undefined){ return false; }
effectData.forEach((effect, effectIndex) => {
console.log('--- Effect '+ effectIndex +' ---');
console.log(effect['description']);
// Loop the triggers
for (const [key, value] of Object.entries(effect['trigger'])) {
console.log('--- Trigger ---');
let effectTrigger = effect['trigger'][key];
console.log(triggerTypes[effectTrigger['triggerTypeId']]);
console.log('--- Trigger Amount ---');
console.log(effectTrigger['amount']);
// Loop targets for said trigger
effectTrigger['target'].forEach((effectTriggerTarget) => {
console.log('--- Trigger Target ---');
console.log(effectTriggerTarget.classId);
console.log(effectTriggerTarget.colourId);
console.log(effectTriggerTarget.passiveId);
console.log(effectTriggerTarget.typeId);
});
}
// Loop the effects
for (const [key, value] of Object.entries(effect['step'])) {
// amoutn, basicEffectId, stepOrder, target (also itemfromstep)
console.log(effect['step'][key]);
console.log('--- Effect Step ---');
let effectStep = effect['step'][key];
console.log(basicEffects[effectStep['basicEffectId']]);
console.log('--- Effect Step Amount ---');
console.log(effectStep['amount']);
// Loop targets for effectStep
effectStep['target'].forEach((effectStepTarget) => {
console.log('--- Effect Step Target ---');
console.log(effectStepTarget.classId);
console.log(effectStepTarget.colourId);
console.log(effectStepTarget.passiveId);
console.log(effectStepTarget.typeId);
console.log(effectStepTarget.itemFromStep);
});
}
});
}

@ -4,6 +4,22 @@ let reach = {};
let equipped = {}; // Entity x has [a,b,c] equipped to it let equipped = {}; // Entity x has [a,b,c] equipped to it
// Trigger types
const triggerTypes = {
1: 'Tap',
2: 'Pay',
};
// Basic effects
// TODO: Pull display name/description from DB?
const basicEffects = {
1: 'Equip',
2: 'Heal',
3: 'Hurt',
4: 'Recruit',
5: 'Give Flight',
};
// Actives to add passives // Actives to add passives
function giveFlight(card){ function giveFlight(card){
flight[card] = true; flight[card] = true;

Loading…
Cancel
Save