User:Illviljan: Difference between revisions
Jump to navigation
Jump to search
>Illviljan mNo edit summary |
>Illviljan No edit summary |
||
Line 17: | Line 17: | ||
{| class="wikitable mw-collapsible mw-collapsed" | {| class="wikitable mw-collapsible mw-collapsed" | ||
! Experience Penalty | ! Experience Penalty. Last updated: 2015-12-10 | ||
|- | |- | ||
| | | | ||
Line 77: | Line 77: | ||
{| class="wikitable mw-collapsible mw-collapsed" | {| class="wikitable mw-collapsible mw-collapsed" | ||
! Chance to hit and avoid attacks | ! Chance to hit and avoid attacks. Last updated: 2015-12-10 | ||
|- | |- | ||
| | | | ||
Line 141: | Line 141: | ||
{| class="wikitable mw-collapsible mw-collapsed" | {| class="wikitable mw-collapsible mw-collapsed" | ||
! Armour Reduction | ! Armour Reduction. Last updated: 2015-12-10 | ||
|- | |- | ||
| | | | ||
Line 184: | Line 184: | ||
{| class="wikitable mw-collapsible mw-collapsed" | {| class="wikitable mw-collapsible mw-collapsed" | ||
! Plot Energy shield recharge | ! Plot Energy shield recharge. Last updated: 2015-12-10 | ||
|- | |- | ||
| | | | ||
Line 213: | Line 213: | ||
|} | |} | ||
{| class="wikitable mw-collapsible mw-collapsed" | |||
! Leech Mechanics. Last updated: 2015-12-10 | |||
|- | |||
| | |||
<pre> | |||
%% Leech mechanics for Path of Exile | |||
% This script analyses how the leech rate changes with increasing number of | |||
% enemies and number of hits on the enemy. | |||
close all, clear all, home | |||
set(0,'DefaultFigureWindowStyle', 'docked'); | |||
%% Input | |||
p = 5000; % Maximum Life. | |||
l = 0.02; % Increased Leech. | |||
m = 0; % Increased Base Leeech Rate. | |||
m_max = 0; % Increased Maximum Leech Rate. | |||
q = 0.02; % Base Leech Rate. | |||
q_max = 0.2; % Base Maximum Leech Rate. | |||
steps = 1000; % Number of steps. | |||
% Damage values from the hit: | |||
d = 4000; %[1000 1000 1000 1000 1000]; | |||
attacksPerSec = 5; % Attacks per Second: | |||
mobsPerAttack = 3; % Enemies hit by one attack: | |||
attackTime = 0:1/attacksPerSec:1; % The time when the attack started. | |||
% The time when the attack hit the target(s): | |||
hitTime = kron(attackTime, ones(1,mobsPerAttack)); % [0 0.01 0.02 0.03 0.04]; | |||
%% Calculations | |||
% Maximum recovery rate: | |||
r_max = (q_max + m_max ) * p; | |||
% Leech duration | |||
t_dur = d * l / (p *q) .* ones(1, length(hitTime)); | |||
% Total allowed leech instance to not exceed the maximum recovery rate | |||
n_tot = (q_max + m_max) / (q * (1 + m)); | |||
% Amount of HP leeched: | |||
LeechAmount = l .* d; | |||
% Maximum analysis time: | |||
maxTime = hitTime(end) + t_dur(end); | |||
% Repeat vectors: | |||
t = linspace(0, maxTime, steps); | |||
instanceRep = repmat((1:length(hitTime))',1,length(t)); | |||
tRep = repmat(t,length(hitTime),1); | |||
AttackTimeRep = repmat(hitTime',1,length(t)); | |||
t_durRep = repmat(t_dur',1,length(t)); | |||
% Boolean conditions to check if there have been an enemy hit and if | |||
% the leeched ife is lower than the total amount of life leeched. | |||
boolHitStart = tRep >= AttackTimeRep; | |||
boolLeechEnd = tRep < AttackTimeRep + t_durRep; | |||
% Both of the above conditions must be true for leech to occur: | |||
boolLeech = (boolHitStart .* boolLeechEnd); | |||
% Base Recovery Rate for each leech instance: | |||
r = (q + m) * p .* boolLeech; | |||
% Each active leech instance: | |||
leechInstance = instanceRep .* boolLeech; | |||
% Base Recovery Rate summarized for all the leech instances: | |||
r_sum = sum(r); | |||
% Check that r_sum is not greater than r_max: | |||
boolLimit = r_sum >= r_max; | |||
r_sum = r_max .* boolLimit + r_sum .*(~boolLimit); | |||
% Pre-load for for-loop: | |||
dt = (maxTime-0)/steps; | |||
HP_i = zeros(length(hitTime),length(t)); | |||
HP_tot = zeros(1,length(t)); | |||
for i = 1:length(t)-1; | |||
% HP restored from each leech instance, this is used to check | |||
% when each leech instance is finished: | |||
HP_i(:,i+1) = q * p .* boolLeech(:,i) * dt + HP_i(:,i); | |||
% Total HP restored from all the leech instances: | |||
HP_tot(:,i+1) = r_sum(:,i) * dt + HP_tot(:,i); | |||
end | |||
%% Plot | |||
figure | |||
leechInstance(leechInstance == 0) = NaN; % Remove zeros from plot. | |||
fig(1) = subplot(3,1,1); | |||
plot(t, leechInstance(:,:)); | |||
ylim([0 length(hitTime)+0.5]); | |||
xlim([0 maxTime]); | |||
xlabel('Time, t, [s]'); | |||
ylabel('Leech instance'); | |||
title('Leech instance'); | |||
for i = 1:length(hitTime); | |||
hold on | |||
% Find the start and end point of each instance and mark it: | |||
[rowStart, colStart] = find(~isnan(leechInstance(i,:)), 1, 'first'); | |||
[rowEnd, colEnd] = find(~isnan(leechInstance(i,:)), 1, 'last'); | |||
plot(t(colStart), leechInstance(i, colStart), '.', ... | |||
t(colEnd), leechInstance(i, colEnd), 'x'); | |||
end | |||
fig(2) = subplot(3,1,2); | |||
[a, h1, h2] = plotyy(t, r_sum, t, r_sum/p); | |||
delete(h2); | |||
NumberOfTicks = 4; | |||
set(a(1), 'ycolor', 'black', ... % Change right axis color to black | |||
'YTick', 0:r_max/NumberOfTicks:r_max); | |||
set(a(2), 'ycolor', 'black', ... % Change left axis color to black | |||
'YTick', 0:q_max/NumberOfTicks:q_max); % | |||
ylim(a(1), [0 r_max]); | |||
ylim(a(2), [0 q_max]); | |||
xlim([0 maxTime]); | |||
xlabel('Time, t, [s]'); | |||
ylabel(a(1), 'Recovery Rate [HP/s]'); | |||
ylabel(a(2), 'Base Rate [HP/(max hp * s)]'); | |||
title('Recovery Rate'); | |||
fig(3) = subplot(3,1,3); | |||
plot(t, HP_tot); | |||
ylim([0 inf]); | |||
xlim([0 maxTime]); | |||
xlabel('Time, t, [s]'); | |||
ylabel('HP restored, [HP]'); | |||
title('HP restored from leech'); | |||
linkaxes(fig,'x') | |||
</pre> | |||
|} | |||
|} | |} |
Revision as of 23:48, 9 December 2015
Collapsible Template |
---|
Text here |
Matlab scripts | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|