Anonymous

Module:CharStats: Difference between revisions

From Elwiki
no edit summary
No edit summary
No edit summary
Line 7: Line 7:
     local args = getArgs(frame);
     local args = getArgs(frame);


     local speed = args.l_slow;
     local stats = {};
     if args['Speed'] == '2' then
     function readStats(stat, value1, value2, value3)
        speed = args.l_average;
        stats[stat] = args[value1]
    elseif args['Speed'] == '3' then
         if args[stat] == '2' then
         speed = args.l_fast;
            args[stat] = args[value2]
    end
        elseif args[stat] == '3' then
 
            args[stat] = args[value3]
    local range = args.l_short;
        end
    if args['Range'] == '2' then
        range = args.l_medium;
    elseif args['Range'] == '3' then
        range = args.l_long;
     end
     end


     local difficulty = args.l_easy;
     readStats('Speed', 'l_slow', 'l_average', 'l_fast');
     if args['Difficulty'] == '2' then
     readStats('Range', 'l_short', 'l_medium', 'l_long');
        difficulty = args.l_normal;
     readStats('Difficulty', 'l_easy', 'l_normal', 'l_hard');
     elseif args['Difficulty'] == '3' then
        difficulty = args.l_hard;
    end


     local type = args.l_magical;
     local type = args.l_magical;
Line 47: Line 40:


     addCell('char-stats-cat', args.l_speed, true);
     addCell('char-stats-cat', args.l_speed, true);
     addCell('char-stats-active', speed);
     addCell('char-stats-active', stats['Speed']);
     addCell('char-stats-attack', type_img);
     addCell('char-stats-attack', type_img);
     addCell('char-stats-cat', args.l_range, true);
     addCell('char-stats-cat', args.l_range, true);
     addCell('char-stats-active', range);
     addCell('char-stats-active', stats['Range']);
     addCell('char-stats-cat', args.l_difficulty, true);
     addCell('char-stats-cat', args.l_difficulty, true);
     addCell('char-stats-active', difficulty);
     addCell('char-stats-active', stats['Difficulty']);
     addCell('char-stats-attack-caption', type, true);
     addCell('char-stats-attack-caption', type, true);