function redraw() { drawfigure("player_avatar", player); if (rival.name !== "") drawfigure("rival_avatar", rival); else { var canvas = document.getElementById("rival_avatar"); var ctx = canvas.getContext("2d"); ctx.beginPath(); ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.beginPath(); var w = canvas.width; canvas.width = 1; canvas.width = w; } drawStats(); } var defaultWindow = ShowCamp; var windows = []; function NextWindow(){ if(windows.length>0){ var nxt =windows.pop(); nxt(); }else{//next round? defaultWindow(); } } function newWindow(windowFunc){ windows.unshift(windowFunc); } function drawStats() { function calcStatWidth(stat) { return stat >= 50 ? (stat - 50) * 2 : (50 - stat) * 1.9; } function appendStat(elem, type, avatar){ var avatarObj = eval(avatar); var appendTo; if (avatarObj == player) { appendTo = ".stat-bar--masc"; $(elem).children(appendTo).first().append("
"); $(elem).children(appendTo).first().children(".avatar-stat--maxmin").first().css("width", calcStatWidth(avatarObj.minimums[type])+"%"); appendTo = ".stat-bar--fem"; $(elem).children(appendTo).first().append(""); $(elem).children(appendTo).first().children(".avatar-stat--maxmin").first().css("width", calcStatWidth(avatarObj.maximums[type])+"%"); } appendTo = avatarObj[type] >= 50 ? ".stat-bar--fem" : ".stat-bar--masc"; $(elem).children(appendTo).first().append(""); $(elem).children(appendTo).first().children(".avatar-stat--"+avatar).first().css("width", calcStatWidth(avatarObj[type])+"%"); } $(".stat-bar-container").each(function(){ $(this).empty(); $(this).append(""); var type = $(this).attr("id"); appendStat(this, type, "player"); appendStat(this, type, "rival"); }); $("#player_changra").html(player.changra); if (getPerceptionRate() >= getRandomInt(0, 100)) $("#rival_changra").html(rival.changra); else $("#rival_changra").html("?"); $("#player_women").html(player.women.length); $("#rival_women").html(rival.women.length); $("#player_perception").html(player.perception()); $("#player_experience").html(player.experience); } function ChoiceMessage(message,title,options){ var wnd= function(){ var buttons = ""; for(var o in options){ buttons+=``; } var msg = `click to continue
"); $("#message").click( function() { $(".stats").show(); if(typeof action=="string"){ eval(action); }else if(typeof action=="function"){ action(); } } ); } } newWindow(wnd); }