Skip to content

Instantly share code, notes, and snippets.

@Kamanar Kamanar/gist:8070970
Last active Jan 1, 2016

What would you like to do?
Quick Attack Script
on("chat:message", function(msg) {
if(msg.type == "api" && msg.content.indexOf("!Attack") !== -1) {
//log("SR Started")
var selected = msg.selected;
//log (selected)
_.each(selected, function(obj) {
var tok = getObj("graphic", obj._id);
var controller = getObj("character", tok.get("represents"));
//log (controller.get("name"));
var Attr1 = findObjs ({name: "Attr1",_type: "attribute", _characterid:}, {caseInsensitive: true})[0];
var CurrentAttr1 = parseInt(Attr1.get("current"));
var MaxAttr1 = Attr1.get("max");
var Attr2 = findObjs ({name: "Attr2",_type: "attribute", _characterid:}, {caseInsensitive: true})[0];
var CurrentAttr2 = Attr2.get("current");
var Damage= parseInt(randomInteger(6) + randomInteger(6) + CurrentAttr1); //2d6 damage + the value of CurrentAttr1
var Health = CurrentAttr2-Damage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.