ummm well you should go into player or playerhandler (i forget) and search something like
"hptype"
then you should see something that has to do with blue hitting red hitting and green, you should be able to figure out from there.
The going from 6's to 5's should be like
if(misc.random(20) == 1 && poisoned && poison <= 2){
hitdiff = 6;
poison ++;
}
if(misc.random(20) == 1 && poisoned && poison >=2 && poison <= 4){
hitdiff = 5;
poison ++;
}
those aren't perfect but hopefully you get the picture.