這將刪除頁面 "Condom - Code - First Version"
。請三思而後行。
//---------------------------------------------------------------------------------------
// Condom handling - replacing prezik, prezikcount, and all the others
//---------------------------------------------------------------------------------------
// *Public - use this from other code
//
// $ARGS[1] - risk: low, medium, high
// - pharmacy is low,
// - a place where it is frequently refilled is medium (gas station dispenser, where there is high traffic)
// - a place where it is not frequently changed is high (agign and such)
// ARGS[2] - the amount
if $ARGS[0] = 'buy_condom':
if $ARGS[1] = 'low':
defectchance = 1
elseif $ARGS[1] = 'medium':
defectchance = 5
elseif $ARGS[1] = 'high':
defectchance = 10
end
random = rand(1,1000)
'random: <<random>>'
if random < defectchance*ARGS[2]:
gs 'shortgs', 'add_condom', 'defective', 1
gs 'shortgs', 'add_condom', 'safe', ARGS[2]-1
else
gs 'shortgs', 'add_condom', 'safe', ARGS[2]
end
gs 'shortgs', 'update_condom_totals'
killvar 'random'
end
// *Public - use this from other code only if specific type is needed to be added.
// for buying or receiving condoms, use 'buy_condom'
// $ARGS[1] - type: safe, sabotaged_known, sabotaged_unknown, defective
// sabotaged unknown is every condom that is faulty, provides no protection, but Sveta is unaware of that.
// ARGS[2] - amount
if $ARGS[0] = 'add_condom':
condom[$ARGS[1]] +=MAX($ARGS[2], 0)
gs 'shortgs', 'update_condom_totals'
end
// *Public - use this from other code only if specific type of condom needed to be removed without it being used.
// for example Sveta goes through her condom collection and eliminates all that was sabotaged by her or
// by someone else (paranoia is healthy).
//
// $ARGS[1] - type: safe, sabotaged_known, sabotaged_unknown, defective
// ARGS[2] - amount
if $ARGS[0] = 'remove_condom':
condom[$ARGS[1]] -= MAX($ARGS[2], 0)
if condom[$ARGS[1]] < 0: condom[$ARGS[1]] = 0
gs 'shortgs', 'update_condom_totals'
end
// *Public - use whenever Sveta loses all the condoms she has.
//
// For now it iss a simple killvar, but I would rather keeping here in case some other logic will be needed.
//
if $ARGS[0] = 'empty_condoms':
killvar 'condom'
end
// *Public - use this to get the relevant available number of condoms, instead of juggling the different totals.
//
// Using this will return the number of usable condoms based on the preference set by Sveta - for safe it does not take
// into account the condoms that she knows are sabotaged.
// If she prefers normal condoms, it will return condom['total_safe_count'] otherwise it will return condom['total_count']
// At least for now. Advantage is that is anything changes, the calling codes won''t have to worry about it.
// Use it as a function
if $ARGS[0] = 'condom_count':
if $condom['preference'] = 'sabotaged':
result = condom['total_safe_count']
else
result = condom['total_count']
end
end
// *Private - do not use it really. It will not cause issues but adding, buying, using condoms automatically calls this
//
// Updated the totals using the different condom types.
// These two lines could be added everywhere where this is called, but if we need some other totals,
// add more types of condoms, etc. then we will have to modify the calculation only here, not everywhere.
if $ARGS[0] = 'update_condom_totals':
condom['total_count'] = condom['safe'] + condom['sabotaged_unknown'] + condom['sabotaged_known'] + condom['defective']
condom['total_safe_count'] = condom['safe'] + condom['sabotaged_unknown'] + condom['defective']
end
// *Public - use this if you want to block Sveta from using condoms.
//
// ARGS[1] - 1 if block is on, 0 if block is off.
// Prevents the use of condoms - for scenes where the condoms are temporarily unavailable for some reason,
// but we don''t want to just throw them away
if $ARGS[0] = 'block_condom':
condom['blocked'] = ARGS[1]
end
// *Public - most of the time this is the one to use to use the condom. Unless the scene calls for a specific type of condom
// - for some reason, in which case use one of the specific calls: 'use_sabotaged_condom', 'use_safe_condom',
// - 'use_specific_condom'
//
// This will use a condom, type decided by preference
// $ARGS[1] - force condom : overrides no condom preference - if $ARGS[2] = 'npc' then $ARGS[1] has no effect
// $ARGS[2] - Is Sveta using her own condoms or the partners. Optional, if no value passed it is the same as 'pc'
// 'pc' or ' ' - Sveta provides the condom
// 'npc' - Partner provides the condom
// $ARGS[3] - Personality of the NPC. Optional no value passed is the same as 'nice'
// ' ' or 'nice' - always uses a safe condom
// 'malicious' - may use a sabotaged condom (10% chance)
// 'saboteur' - 100% uses a sabotaged condom.
if $ARGS[0] = 'use_a_condom':
if $ARGS[1] = 'npc':
if $ARGS[2] = 'malicious': sabchance = 10
if $ARGS[2] = 'saboteur': sabchance = 100
if rand(1,100) <= sabchance:
gs 'shortgs', 'use_a_sabotaged_condom', 'npc'
else
gs 'shortgs', 'use_a_safe_condom'
end
killvar 'sabchance'
else
// NOTE: I am not 100% convinced about this
if $condom['preference'] = 'none' and $ARGS[1] ! 'force_condom':
gs 'shortgs', 'use_no_condom'
elseif $condom['preference'] = 'sabotaged' and condom['sabotaged_known'] > 0:
gs 'shortgs', 'use_a_sabotaged_condom'
else
gs 'shortgs', 'use_a_safe_condom'
end
end
end
// *Public - whenever possible, use 'use_a_condom'. Only use if for some reason the selection is constrained
//
// This will use a supposedly safe condom
// $ARGS[1] - who provides the condom: 'npc' - the NPC picks and uses the condom
// 'pc' or ' ' - Sveta provides the condom
if $ARGS[0] = 'use_a_safe_condom':
condom['breakchance'] = 0
$condom['used'] = ''
if $ARGS[1] = 'npc':
random = rand(1,100)
if random < 3: bad = 2
else
random = rand(1,condom['total_safe_count'])
if random < condom['sabotaged_unknown']:
bad = 1
elseif random < condom['sabotaged_unknown']+condom['defective']:
bad = 2
end
end
// bad = 1 - sabotaged condom. Sabitaged condom provide no protection.
// bad = 2 - defective condom. Defective condom has a higher chance to break or slip or burst.
if bad = 1:
noprotect = 1
sexcontra = 6
$condom['used'] = 'sabotaged_unknown'
if $ARGS[1] = 'pc': condom['sabotaged_unknown'] -= 1
elseif bad = 2:
protect = 1
sexcontra = 3
$condom['used'] = 'defective'
condom['breakchance'] = rand(10,50)
if $ARGS[1] ! 'npc': condom['defective'] -= 1
else
protect = 1
sexcontra = 3
$condom['used'] = 'safe'
if $ARGS[1] ! 'npc': condom['safe'] -= 1
end
// This may change, as 'safe' is what Sveta think happened, not what necessarily happened.
$condom['used'] = 'safe'
gs 'shortgs', 'update_condom_totals'
killvar 'bad'
killvar 'random'
end
// *Public - whenever possible, use 'use_a_condom'. Only use if for some reason the selection is constrained
//
// This will use a sabotaged condom
// $ARGS[1] - who provides the condom: 'npc' - the NPC picks and uses the condom
// 'pc' or ' ' - Sveta provides the condom
if $ARGS[0] = 'use_a_sabotaged_condom':
$condom['used'] = ''
noprotect = 1
if $ARGS[1] = 'npc':
sexcontra = 6
$condom['used'] = 'sabotaged_unknown'
else
sexcontra = 7
condom['sabotaged_known'] -= 1
$condom['used'] = 'sabotaged_known'
gs 'shortgs', 'update_condom_totals'
end
end
// *Public - whenever possible, use 'use_a_condom'. Only use if for some reason the scene calls for a specifi type of condom
//
// This will use the type of condom that is passed in $ARGS[1]
if $ARGS[0] = 'use_a_specific_condom_type':
$condom['used'] = ''
condom['breakchance'] = 0
if $ARGS[1] = 'safe':
sexcontra = 3
protect = 1
condom['safe'] -= 1
$condom['used'] = 'safe'
elseif $ARGS[1] = 'defective':
sexcontra = 3
protect = 1
condom['defective'] -= 1
condom['breakchance'] = rand(10,50)
$condom['used'] = 'defective'
elseif $ARGS[1] = 'sabotaged_known':
sexcontra = 7
noprotect = 1
condom['sabotaged_known'] -= 1
$condom['used'] = 'sabotaged_known'
elseif $ARGS[1] = 'sabotaged_unknown':
sexcontra = 6
noprotect = 1
condom['sabotaged_unknown'] -= 1
$condom['used'] = 'sabotaged_unknown'
end
end
// *Public - use sparingly. If Sveta has a preference for 'no condonm' the 'use_a_condom' will provide the same method.
//
// Just for consistency. Basically here we can set all the required variables that tell
// the code everywhere that there is no condom used this time.
// And then it is all in one place, not spread out across the different scenes and other functions.
if $ARGS[0] = 'use_no_condom':
$condom['used'] = ''
noprotect = 1
$condom['used'] = 'none'
end
// *Public - sets the preference for the type of condom used. Use this instead of directly the array variable
//
// This sets whether Sveta will prefer to use a normal or a sabotaged condom
// $ARGS[1] - 'sabotaged', 'safe', 'none'
if $ARGS[0] = 'condom_preference':
$condom['preference'] = $ARGS[1]
end
// *Public
//
// Convert safe condoms to sabotaged condoms
// ARGS[1] - amount of condoms in case someone implements a batch sabotage
if $ARGS[0] = 'sabotage_condom':
temp_amount =MIN(MAX(ARGS[1],0), condom['total_safe_count'])
:rampage_round
random = rand(1,condom['total_safe_count'])
if random < condom['sabotaged_unknown']:
condom['sabotaged_unknown'] -= 1
elseif random < condom['sabotaged_unknown']+condom['defective']:
condom['defective'] -= 1
else
condom['safe'] -= 1
end
condom['sabotaged_known'] += 1
gs 'shortgs', 'update_condom_totals'
i += 1
if i < temp_amount : jump 'rampage_round'
killvar 'temp_amount'
end
這將刪除頁面 "Condom - Code - First Version"
。請三思而後行。